This content has been marked as final. Show 3 replies
chetah wrote:Right. As the error message tells you, String does not have a static isDigit method that takes a String arg.
error: cannot find symbol method isDigit(java.lang.String) line 13
when I use Character.isDigit(s), it separates the digits, for example 51 becomes a 5 and a 1.No, that's not what isDigit does. It simply tells you whether a given character is a digit or not. You have to separate them yourself first.
How can I manipulate the data so that the digits in the number stays together?Well, if you want to examine the individual characters to test whether they're digits, you'll have to break the String into chars. So look at String's methods to see if you can find one that will help you with that. Note that Strings are immutable, so you already know that your original String will remain untouched.