Monday, 17 February 2014

How to check a string has only numbers?

String numeric = '123';
system.debug('Is Numeric :: '+numeric.isNumeric()); //returns true


String alphanumeric = '123abc';
system.debug('Is Numeric :: '+alphanumeric.isNumeric()); //returns false

No comments:

Post a Comment