About 50 results
Open links in new tab
  1. Difference between String trim() and strip() methods

    The methods that only accept a char value cannot support supplementary characters. ... The methods that accept an int value support all Unicode characters, including supplementary characters. …

  2. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · Other Methods To Consider String.equalsIgnoreCase () value equality that ignores case. Beware, however, that this method can have unexpected results in various locale-related cases, see …

  3. java - Difference between String replace () and replaceAll () - Stack ...

    May 31, 2012 · What's the difference between java.lang.String 's replace() and replaceAll() methods, other than the latter uses regex? For simple substitutions like, replace . with /, is there any difference?

  4. Sort a single String in Java - Stack Overflow

    Is there a native way to sort a String by its contents in java? E.g. String s = "edcba" -> "abcde"

  5. How to format strings in Java - Stack Overflow

    Primitive question, but how do I format strings like this: "Step {1} of {2}" by substituting variables using Java? In C# it's easy.

  6. Reverse a string in Java - Stack Overflow

    One natural way to reverse a String is to use a StringTokenizer and a stack. Stack is a class that implements an easy-to-use last-in, first-out (LIFO) stack of objects.

  7. How to initialize List<String> object in Java? - Stack Overflow

    Nov 15, 2012 · List is an Interface, you cannot instantiate an Interface, because interface is a convention, what methods should have your classes. In order to instantiate, you need some …

  8. How do I invoke a Java method when given the method name as a …

    Object obj; String methodName = "getName"; Without knowing the class of obj, how can I call the method identified by methodName on it? The method being called has no parameters, and a String …

  9. java - Simple way to repeat a string - Stack Overflow

    I'm looking for a simple commons method or operator that allows me to repeat some string n times. I know I could write this using a for loop, but I wish to avoid for loops whenever necessary and a ...

  10. How do I convert a String to an int in Java? - Stack Overflow

    Alternatively, you can use an Ints method from the Guava library, which in combination with Java 8's Optional, makes for a powerful and concise way to convert a string into an int: