Sunday, 1 November 2015

Split the string between open bracket and close bracket () in java

Example string:
String text =Compare string (43)
Here, i want to print only 43.

Logic:
    String[] part1=text.split("\\(");
        String part2=part1[1];
        String count=part2.replace(")", "");
       
        return count;

No comments:

Post a Comment