There’s probably a really neat RegExp, but I’m noob in that area, so instead…
String s = "test string (67)";
s = s.substring(s.indexOf("(") + 1);
s = s.substring(0, s.indexOf(")"));
System.out.println(s);
More Related Contents:
- can't input value for string?
- How do I print my Java object without getting “SomeType@2f92e0f4”?
- Java String split removed empty values
- How can I pad a String in Java?
- Read/Write String from/to a File in Android
- What’s the best way to check if a String represents an integer in Java?
- How to parse a mathematical expression given as a string and return a number? [duplicate]
- Regex to match a C-style multiline comment
- Does Java have support for multiline strings?
- Comparing strings with == which are declared final in Java
- Get variable by name from a String
- How to remove single character from a String
- Why does println(array) have strange output? (“[Ljava.lang.String;@3e25a5”) [duplicate]
- Is there a method for String conversion to Title Case?
- Count words in a string method?
- How to compress a String in Java?
- will two strings with same content be stored in the same memory location?
- Sprintf equivalent in Java
- Create a mutable java.lang.String
- Java String.split() sometimes giving blank strings
- How to convert a String to CharSequence?
- How to remove only trailing spaces of a string in Java and keep leading spaces?
- How to get address of a Java Object? [duplicate]
- A method to reverse effect of java String.split()? [duplicate]
- Java string intern and literal
- Creating a factory method in Java that doesn’t rely on if-else
- Find all words with 3 letters with regex
- Translating strings character by character
- Can we access or query the Java String intern (constant) pool?
- Java printf using variable field size?