See String.format
method.
String s = "hello %s!";
s = String.format(s, "world");
assertEquals(s, "hello world!"); // should be true
More Related Contents:
- implement length() of string without using Built-in functions [closed]
- How to split strings based on "/n" in Java [closed]
- Can I product of charAt in Java? [duplicate]
- Need the words between the ” – ” ONLY string splitting [duplicate]
- Problems converting byte array to string and back to byte array
- Parse String to Date with Different Format in Java
- Why does String.split need pipe delimiter to be escaped?
- When will a string be garbage collected in java
- How can I use “.” as the delimiter with String.split() in java [duplicate]
- Converting Secret Key into a String and Vice Versa
- Reverse a given sentence in Java
- Extract string between two strings in java
- formatting a string to a currency format in jasper report
- How to check if a string starts with one of several prefixes?
- How to convert a String into an ArrayList?
- java.lang.NumberFormatException: empty String
- Convert String to Uri
- Calculating frequency of each word in a sentence in java
- Remove all non-“word characters” from a String in Java, leaving accented characters?
- Fastest way to strip all non-printable characters from a Java String
- Simple way to sort strings in the (case sensitive) alphabetical order
- How to search a string in another string? [duplicate]
- Java: Why can String equality be proven with ==?
- How can I read comma separated values from a text file in Java?
- How to check whether given string is a word
- Difference between String#equals and String#contentEquals methods
- Java: Get last element after split
- In Java, how to append a string more efficiently? [duplicate]
- Why new keyword not needed for String
- Replacing single ‘\’ with ‘\\’ in Java