java - How do I get only integers from a string? -
this question has answer here:
i have text field can enter string.
but need return integer using string.
i know how convert strings integers, how separate letters & punctuation string leaves numbers?
try code:
string str = "a1?2.33/4tyz.7!8x"; str = str.replaceall("\\d", ""); now str contain "1233478"
Comments
Post a Comment