Single line command to extract digit from a String
Eg. text = All (68)
text = text.replaceAll("\\D+", "");
Output - text = 68
Now \D represent the digit character i.e. 68
Also \d represent the non-digit character i.e. All ()
+ represent one or more time
Eg. text = All (68)
text = text.replaceAll("\\D+", "");
Output - text = 68
Now \D represent the digit character i.e. 68
Also \d represent the non-digit character i.e. All ()
+ represent one or more time
No comments:
Post a Comment