Tutorial Archive
Description: This method returns the length of this string. The length is equal to the number of 16-bit Unicode characters in the string. Syntax: Here is the syntax of this method: public int length() Parameters: …
Description: This method has following variants: int lastIndexOf(int ch): Returns the index within this string of the last occurrence of the specified character or -1 if the character does not occur. public int lastIndexOf(int ch, …
Description: This method returns a canonical representation for the string object. It follows that for any two strings s and t, s.intern() == t.intern() is true if and only if s.equals(t) is true. Syntax: Here …
Description: This method has following different variants: public int indexOf(int ch): Returns the index within this string of the first occurrence of the specified character or -1 if the character does not occur. public int …
Description: This method returns a hash code for this string. The hash code for a String object is computed as: s*31^(n-1) + s*31^(n-2) + … + s Using int arithmetic, where s is the ith …
Description: This method copies characters from this string into the destination character array. Syntax: Here is the syntax of this method: public void getChars(int srcBegin, int srcEnd, char dst, int dstBegin) Parameters: Here is the …
Description: This method has following two forms: getBytes(String charsetName): Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array. getBytes(): Encodes this String into a …