Example | |
|
Solution |
Use StringTokenizer to parse the string instead.
|
public class ClassA { public void test () { String stringObject = "my.test" ; // to print out the object name "my" StringTokenizer st = new StringTokenizer (stringObject, "."); System.out.println( st.nextToken() ); } } |