The Java String replace() method replaces each substring of this string that matches the literal target substring. The matching process starts at index 0.
The Java String concat() method concatenates the method argument string to the end of string object. 1. String concat(String str) method Internally, Java creates a new character array with combined length of string object and argument string, and copies all content from both strings into this new array. Finally, combiner character array is converted to […]
Java String substring() example. Learn to get substring of a string from given start index to end index. A valid index is between 0 and length of string.
Java String lastIndexOf() method. It returns the last index of specified character or string as method argument. If argument is not found it returns -1.
The Java String indexOf() method returns the index of given character or string as method argument. If argument is not found in string, method returns -1. The index counter for a string starts from zero.