Java String Method
Introduction
public String(byte[] bytes, int offset, int length, String charsetName)
Method Summary:
| Name | Type | Description |
|---|---|---|
| charAt(int index) | char | Returns the char value at the specified index. |
| codePointAt(int index) | int | Returns the character (Unicode code point) at the specified index. |
| codePointBefore(int index) | int | Returns the character (Unicode code point) before the specified index. |
| codePointCount(int beginIndex, int endIndex) | int | Returns the number of Unicode code points in the specified text range of this String. |
| compareTo(String anotherString) | int | Compares two strings lexicographically. |
| compareToIgnoreCase(String str) | int | Compares two strings lexicographically, ignoring case differences. |
| concat(String str) | String | Concatenates the specified string to the end of this string. |
| contains(CharSequence s) | boolean | Returns true if and only if this string contains the specified sequence of char values. |
| contentEquals(CharSequence cs) | boolean | Compares this string to the specified CharSequence. |
| contentEquals(StringBuffer sb) | boolean | Compares this string to the specified StringBuffer. |
| copyValueOf(char[] data) | String | Equivalent to valueOf(char[]). |
| copyValueOf(char[] data, int offset, int count) | String | Equivalent to valueOf(char[], int, int). |
| endsWith(String suffix) | boolean | Tests if this string ends with the specified suffix. |
| equals(Object anObject) | boolean | Compares this string to the specified object. |
| equalsIgnoreCase(String anotherString) | boolean | Compares this String to another String, ignoring case considerations. |
| format(String format, Object... args) | String | Returns a formatted string using the specified format string and arguments. |
| format(Locale l, String format, Object... args) | String | Returns a formatted string using the specified locale, format string, and arguments. |
| getBytes() | byte | 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) | byte | Encodes this String into a sequence of bytes using the given charset, storing the result into a new byte array. |
| getBytes(String charsetName) | byte | Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array. |
| getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) | void | Copies characters from this string into the destination character array. |
| hashCode() | int | Returns a hash code for this string. |
| indexOf(int ch) | int | Returns the index within this string of the first occurrence of the specified character |
| indexOf(int ch, int fromIndex) | int | Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index. |
| indexOf(String str) | int | Returns the index within this string of the first occurrence of the specified substring. |
| indexOf(String str, int fromIndex) | int | Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. |
| intern() | String | Returns a canonical representation for the string object. |
| isEmpty() | boolean | Returns true if, and only if, length() is 0. |
| join(CharSequence delimiter, CharSequence... elements) | String | Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimite. |
| join(CharSequence delimiter, Iterable<? extends CharSequence> elements) |
String | Returns a new String composed of copies of the CharSequence elements joined together with a copy of the specified delimiter. |
| lastIndexOf(int ch) | int | Returns the index within this string of the last occurrence of the specified character. |
| lastIndexOf(int ch, int fromIndex) | int | Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index. |
| lastIndexOf(String str) | int | Returns the index within this string of the last occurrence of the specified substring. |
| lastIndexOf(String str, int fromIndex) | int | Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index. |
| length() | int | Returns the length of this string. |
| matches(String regex) | boolean | Tells whether or not this string matches the given regular expression. |
| offsetByCodePoints(int index, int codePointOffset) | int | Returns the index within this String that is offset from the given index by codePointOffset code points. |
| regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len) | boolean | Tests if two string regions are equal. |
| regionMatches(int toffset, String other, int ooffset, int len) | boolean | regionMatches(int toffset, String other, int ooffset, int len) |
| replace(char oldChar, char newChar) | String | Returns a string resulting from replacing all occurrences of oldChar in this string with newChar. |
| replace(CharSequence target, CharSequence replacement) | String | Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. |
| replaceAll(String regex, String replacement) | String | Replaces each substring of this string that matches the given regular expression with the given replacement |
| replaceFirst(String regex, String replacement) | String | replaceFirst(String regex, String replacement) |
| split(String regex) | String | Splits this string around matches of the given regular expression. |
| split(String regex, int limit) | String | Splits this string around matches of the given regular expression. |
| startsWith(String prefix) | boolean | Tests if this string starts with the specified prefix. |
| startsWith(String prefix, int toffset) | boolean | Tests if the substring of this string beginning at the specified index starts with the specified prefix. |
| subSequence(int beginIndex, int endIndex) | CharSequence | Returns a character sequence that is a subsequence of this sequence. |
| substring(int beginIndex) | String | Returns a string that is a substring of this string. |
| substring(int beginIndex, int endIndex) | String | Returns a string that is a substring of this string. |
| toCharArray() | char | Converts this string to a new character array. |
| toLowerCase() | String | Converts all of the characters in this String to lower case using the rules of the default locale. |
| toLowerCase(Locale locale) | String | Converts all of the characters in this String to lower case using the rules of the given Locale. |
| toString() | String | This object (which is already a string!) is itself returned. |
| toUpperCase() | String | Converts all of the characters in this String to upper case using the rules of the default locale. |
| toUpperCase(Locale locale) | String | Converts all of the characters in this String to upper case using the rules of the given Locale. |
| trim() | String | Returns a string whose value is this string, with any leading and trailing whitespace removed. |
| valueOf(boolean b) | boolean | Returns the string representation of the boolean argument. |
| valueOf(char c) | char | Returns the string representation of the char argument. |
| valueOf(char[] data) | char | Returns the string representation of the char array argument. |
| valueOf(char[] data, int offset, int count) | String | Returns the string representation of a specific subarray of the char array argument. |
| valueOf(double d) | String | Returns the string representation of the double argument. |
| valueOf(float f) | String | Returns the string representation of the float argument. |
| valueOf(int i) | String | Returns the string representation of the int argument. |
| valueOf(long l) | String | Returns the string representation of the long argument. |
| valueOf(Object obj) | String | Returns the string representation of the Object argument. |
Previous:toString Method
Next:charAt Method
