How do I replace characters in string?
Category: java.lang, viewed: 1026 time(s).
package org.kodejava.example.lang; public class StringReplace { public static void main(String[] args) { String text = "The quick brown fox jumps over the lazy dog"; // // The replace method replace all occurrences of character 'o' with 'u' // and returns a new string object. // text = text.replace('o', 'u'); System.out.println("Result: " + text); } } |
Related Examples
- How do I read system property as an integer?
- How do I decode string to integer?
- How do I insert a string in the StringBuilder?
- How do I remove substring from StringBuilder?
- How do I reverse a string by word?
- How do I convert varargs to an array?
- How do I remove trailing white space from a string?
- How do I remove leading white space from a string?
- How do I create a method that accept varargs in Java?
- How do I know a class of an object?
|
|