0% found this document useful (0 votes)
14 views3 pages

14 June 2022

This document summarizes common String class methods in Java. It lists methods such as concat() to concatenate Strings, length() to get character count, charAt() to access individual characters, equals() to compare Strings, and toLowerCase()/toUpperCase() to convert case. Other methods covered include startsWith() to check prefixes, intern() to reference Strings, equalsIgnoreCase() to compare ignoring case, substring() to extract portions, replace() to substitute characters, trim() to remove whitespace, and indexOf() to find character positions.

Uploaded by

sandesh ahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

14 June 2022

This document summarizes common String class methods in Java. It lists methods such as concat() to concatenate Strings, length() to get character count, charAt() to access individual characters, equals() to compare Strings, and toLowerCase()/toUpperCase() to convert case. Other methods covered include startsWith() to check prefixes, intern() to reference Strings, equalsIgnoreCase() to compare ignoring case, substring() to extract portions, replace() to substitute characters, trim() to remove whitespace, and indexOf() to find character positions.

Uploaded by

sandesh ahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

String Class Methods:

Method Description
String concat (String str) Concatenates calling String with
str. Note: + also used to do the
same
int length () Returns length of a String
char charAt (int index) Returns the character at
specified location ( from 0)

boolean equals (String str) Returns true if calling String


equals str.
boolean startsWith( String prefix ) Returns true if calling String
starts with prefix

String toLowerCase () converts all characters into lowercase

String toUpperCase () converts all characters into uppercase


Method Description

This method is used to get corresponding


intern() SCP object with the help of heap object
reference.

boolean equalsIgnoreCase(String s) This method is used for content


comparison where case is not important.

String substring(int begin) Return the substring from begin index to end
of the string

String substring(int begin, int end) Returns the substring from begin index to
end-1 index.

String replace(char old, char new) To replace every old character with a
new character.

String trim() This method is used to remove blank spaces


present at beginning and end of the string but
not blank spaces present at middle of the
String.
int indexOf(char ch) returns index of 1st occurrence of the specified
character if the specified character is not
available then return -1

You might also like