java.lang.String
The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.
Strings are constant their values cannot be changed after they are created.
String buffers support mutable strings. Because String objects are immutable they can be shared.
Some Methods of String class
charAt(): It returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.
codePointAt(): It returns the character (Unicode code point) at the specified index. The index refers to char values(Unicode code units) and ranges from 0 to length() - 1.
codePointBefore(): It returns the character (Unicode code point) before the specified index.
codePointCount(): It returns the number of Unicode code points in the specified text range of this String.
compareTo(): It compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.
compareToIgnoreCase(): It compares two strings lexicographically, ignoring case differences.
concat(): It concatenates the specified string to the end of this string.
contains(): It returns true if and only if this string contains the specified sequence of char values.
contentEquals(CharSequence cs): It compares this string to the specified CharSequence.
contentEquals(StringBuffer sb): It compares this string to the specified StringBuffer.
String.copyValueOf(char[] data): It returns the String representation of the char array characters.
String.copyValueOf(char[] data, int offset, int count): It returns the string that contains the character of the specified sub-array.
endsWith(): It tests if this string ends with the specified suffix.
equals(): It compares this string to the specified object.
equalsIgnoreCase(): It Compares this String to another String, ignoring case considerations.
String.format(): It returns a formatted string using the specified format string and arguments.
formatted(): It formats using this string as the format string, and the supplied arguments.
String.format(Locale l, String format, Object... args): It returns a formatted string using the specified locale, format string, and arguments.
getBytes(): It encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
getBytes(Charset charset): It encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array.
Some more Methods of String Part - II
Some More Methods of String Part - III
Some more Methods of String Part - IV
No comments:
Post a Comment