About 395,000 results
Open links in new tab
  1. java - how to replace characters in a string with integers?

    Sep 7, 2013 · str = str.replace("a", "0").replace("b", "1"); We require an assignment back to 'str' because str.replace () returns a new String and the original string would be unchanged.

  2. java - Replacing the character in a String by integer - Stack Overflow

    You'll want to appendTail() after the loop. Won't matter in this example case, but it will matter if the String ends with a number, because otherwise you will lose anything after the last letter. Love …

  3. Java Convert int to String – Different Ways of Conversion

    Apr 9, 2025 · There are certain methods for Integer to String conversions mentioned below: Using the toString () method of the Integer class Using the valueOf () method of the String class …

  4. java - To replace integer by a string - Stack Overflow

    Oct 15, 2016 · In the code give on the site this could be done using a simple string contains method. if (Integer.toString(i).contains("7"){ primeNumbers = primeNumbers + "S" + " "; else { …

  5. StringBuffer replace () Method in Java with Examples

    Dec 13, 2021 · The StringBuffer.replace () is the inbuilt method which is used to replace the characters in a substring of this sequence with the characters in the specified String. Here …

  6. StringBuilder replace() in Java with Examples - GeeksforGeeks

    Apr 18, 2023 · The replace (int start, int end, String str) method of StringBuilder class is used to replace the characters in a substring of this sequence with characters in the specified String.

  7. Java String replace () Method - W3Schools

    Definition and Usage The replace() method searches a string for a specified character, and returns a new string where the specified character (s) are replaced.

  8. 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 …

  9. 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 …

  10. Replacing Integers with Strings Java - Stack Overflow

    Dec 26, 2014 · How do I get the relevant numbers to be replaced by the correct string statements instead of what I currently have? I only managed to find tips on converting strings to integers, …

Refresh