About 1,390,000 results
Open links in new tab
  1. How to replace characters in a java String? - Stack Overflow

    Apr 16, 2010 · I like to replace a certain set of characters of a string with a corresponding replacement character in an efficent way. For example: String sourceCharacters = …

  2. Replace a character at a specific index in a String in Java

    Jan 8, 2024 · Replace the character at the specific index by calling this method and passing the character and the index as the parameter. StringBuffer is thread-safe and can be used in a …

  3. Manipulating Characters in a String (The Java™ Tutorials - Oracle

    The String class provides accessor methods that return the position within the string of a specific character or substring: indexOf() and lastIndexOf(). The indexOf() methods search forward …

  4. Remove or Replace Part of a String in Java - Baeldung

    Jun 15, 2024 · In this tutorial, we’re going to be looking at various means we can remove or replace part of a String in Java. We’ll explore removing and/or replacing a substring using a …

  5. Changing characters in a string in java - Stack Overflow

    Oct 5, 2018 · Create new StringBuffer() and add the character via append({char}) method. Once all characters are appended, convert StringBuffer to String via toString() method.

  6. String replace() method in Java with Examples - GeeksforGeeks

    Feb 16, 2024 · The String replace () method returns a new string after replacing all the old characters/CharSequence with a given character/CharSequence. Example: Return a new …

  7. The Complete Guide to Java String Replace - DEV Community

    Mar 1, 2021 · String.replace() is used to replace all occurrences of a specific character or substring in a given String object without using regex. There are two overloaded methods …

  8. Java Strings - Special Characters - W3Schools

    The solution to avoid this problem, is to use the backslash escape character. The backslash (\) escape character turns special characters into string characters:

  9. java - Replace a character at a specific index in a string? - Stack ...

    Aug 5, 2011 · You can overwrite a string, as follows: String myName = "halftime"; myName = myName.substring(0,4)+'x'+myName.substring(5); Note that the string myName occurs on …

  10. Java String replace () Method with Examples - DataFlair

    The replace () method in the Java String class replaces every occurrence of a character/substring with a new character/substring and returns the resulting string.

Refresh