Replace( )

Replace( )  The replace( ) method replaces all occurrences of one character in the invoking string with character. It has the following general form: String replace(char original, char replacements Here, original specifies the character to be replaced by the character...

Sub string( )

Sub string( )  You can extract a sub string using sub string( ).It has two forms. The first is String sub string(int start index) Here, start index specifies the index at which the sub string will begin. This form returns a copy of the sub string that-begins at start...

Searching Strings

Searching Strings The String class provides two methods that allow you to search a string for a specified character or sub string  index Of() Searches f!:>the first occurrence of a character or sub string. IZI Elastoplast() Searches for the last occurrence of a...

Compare To( )

Compare To( ) Often, it is not enough to simply know whether two strings arc Identical. Sot sorting applications, you need to know which is less than, equal.to, or greater than the next. A string is less than another if it comes before the other in dictionary- order....

Starts With( ) and ends With( )

Starts With( ) and ends With( ) String defines two routines that are, more or less, specialized forms of congregationalists] ). The starts With( ) method determines whether a given String begins with a specified string. Conversely, ends With() determines whether the...

Equals() and countersignature( )

Equals() and countersignature( ) To compare two strings equality, use equals(). It has this general form: Boolean equals(Object st) Here, str is the String object being compared with the invoking String object. It returns – true if the strings contain the same...