Java Functions (character and strings)

To use Java library functions, import the class type from java.lang package. Functions defined under java library include character function, string function, string buffer function and mathematical functions. Character type variable can hold a single character. Character.isLetter( ) is used to check whether a given argument is an alphabet or not. Character.isDigit( ) is used to check whether a given argument is numeric or not. Character.isLetterOrDigit( ) checks whether a given argument is either alphabet or numeric. Character.isWhiteSpace( ) is used to check for existing blank or gap in a String. Character.isUpperCase( ) checks whether a given argument is an uppercase alphabet or not. Character.isLowerCase( ) is used to check whether a given argument is in lowercase alphabet or not. Character.toLowerCase( ) returns the given alphabet in lowercase. Character.toUpperCase( ) returns the given alphabet in uppercase. String class represents collection of characters. String functions deal only with string manipulations. Commonly used string functions in Java include length(), charAt(), indexOf(), lastIndexOf(),substring( ), toLowerCase(), toUpperCase(), replace(), concat(), equals( ), equalsIgnoreCase( ), compareTo(), trim(), endsWith() and startsWith(). Strings in Java are created by declaring object of string type class and initializing it with a string literal. The append() is used to add a string at the end of another string. The setCharAt( ) is used to replace a character with another character at specified index. The insert() is used to insert a string at specified index into another string. The reverse() is used to reverse the character of a given string. The mathematical functions are used to do fast calculation in a program. Commonly used mathematical functions in Java include abs(), max(), min(), sin(), cos() etc.

To Access the full content, Please Purchase