Functions
List of Functions in Java and their use:
charAt(int index)
Returns the character at the specified index.
compareTo(Object o)
Compares this String to another Object
compareToIgnoreCase(String str)
Compares two strings lexicographically ignoring case considerations.
copyValueOf(char[] data, int offset, int count)
Returns a String that is equivalent to the specified character array.
getBytes()
Convert this String
into bytes according to the platform's default character encoding, storing the result into a new byte array.
getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)
Deprecated. This method does not properly convert characters into bytes
getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Copies characters from this string into the destination character array.
indexOf(int ch, int fromIndex)
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index
indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character.
intern()
Returns a canonical representation for the string object.
lastIndexOf(int ch, int fromIndex)
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index
lastIndexOf(int ch)
Returns the index within this string of the last occurrence of the specified character.
lastIndexOf(String str, int fromIndex)
Returns the index within this string of the last occurrence of the specified substring.
lastIndexOf(String str)
Returns the index within this string of the rightmost occurrence of the specified substring
length()
Returns the length of this string.
regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
Tests if two string regions are equal
regionMatches(int toffset, String other, int ooffset, int len)
Tests if two string regions are equal.
replace(char oldChar, char newChar)
Returns a new string resulting from replacing all occurrences of oldChar
in this string with newChar
.
startsWith(String prefix, int toffset)
Tests if this string starts with the specified prefix.
startsWith(String prefix)
Tests if this string starts with the specified prefix
substring(int beginIndex, int endIndex)
Returns a new string that is a substring of this string
substring(int beginIndex)
Returns a new string that is a substring of this string
Converts this string to a new character array.
Converts all of the characters in this String
to lower case using the rules of the default locale, which is returned by Locale.getDefault
.
toString()
This object (which is already a string!)
Converts all of the characters in this String
to upper case using the rules of the default locale, which is returned by Locale.getDefault
trim()
Removes white space from both ends of this string
valueOf(boolean b)
Returns the string representation of the boolean
argument.
valueOf(boolean b)
Returns the string representation of the boolean
argument.
valueOf(char[] data, int offset, int count)
Returns the string representation of a specific subarray of the char
array argument
valueOf(char[] data)
Returns the string representation of the char
array argument
valueOf(double d)
Returns the string representation of the double
argument.
valueOf(float f)
Returns the string representation of the float
argument
valueOf(int i)
Returns the string representation of the int
argument.
valueOf(long l)
Returns the string representation of the long
argument.
abs() -Returns absolute value
round() -It rounds the value to nearest integer
min() – Returns minimum value between two numbers
max()-Returns maximum value between two numbers
random() – Generates a random number
isLetter() – Checks weather the value is Alfa byte or not?
isDigit() -Checks weather the value is Number or not?
isUpperCase() – Checks weather the value is Upper case or not?
isLowerCase()-Checks weather the value is Lower case or not?
contains() – Checks if the Array contains certain value or not?