Substring
StringBuffer - creates mutable string. String is originally immutable. Used operation on Strings
StringBuilder - more efficient than StringBuffor
https://www.javatpoint.com/StringBuilder-class
- public String substring(int startIndex)
- public String substring(int startIndex, int endIndex)
String s= "Hello World"; System.out.println(s.substring(3)); System.out.println(s.substring(1,3));
StringBuffer - creates mutable string. String is originally immutable. Used operation on Strings
StringBuffer buffer = new StringBuffer("Hello World"); buffer.append(" GREAT ADDITION"); System.out.println(buffer);
StringBuilder - more efficient than StringBuffor
https://www.javatpoint.com/StringBuilder-class
- charAt() - returns char on defined index
- contains() - true false
- endsWith() startsWith() -
- indexOf() - returns index of char
- isEmpty() - true false
- length() -
- replace() - replace char
- split()
- trim() -
- toLowerCase() i toUpperCase
Komentarze
Prześlij komentarz