1 . int compareTo() : Compares two strings lexicographically(Alphabetical order).
2. string compareToIgnoreCase() : Compares two strings lexicographically, ignoring case differences(independent of lower or upper case).
Find out at least 10 methods of a String?
1 . int compareTo() : Compares two strings lexicographically(Alphabetical order).
-
string compareToIgnoreCase() : Compares two strings lexicographically, ignoring case differences(independent of lower or upper case).
-
string concat() : Appends a string to the end of another string.
-
boolean contains() : Checks whether a string contains a sequence of characters.
-
boolean contentEquals() : Checks whether a string contains the exact same sequence of characters of the specified CharSequence or StringBuffer.
-
string copyValueOf() : Returns a String that represents the characters of the character array.
-
boolean equals() : Compares two strings. Returns true if the strings are equal, and false if not.
-
boolean equalsIgnoreCase() : Compares two strings, ignoring case considerations.
-
string format() : Returns a formatted string using the specified locale, format string, and arguments.
-
void getChars() : Copies characters from a string to an array of chars.
-
int indexOf() : Returns the position of the first found occurrence of specified characters in a string.
-
string intern() : Returns the canonical representation for the string object.
-
boolean isEmpty() : Checks whether a string is empty or not.
-
string replace() : Searches a string for a specified value, and returns a new string where the specified values are replaced.
-
string toLowerCase() : Converts a string to lower case letters.
-
string toUpperCase() : Converts a string to upper case letters.
-
string toString() : Returns the value of a String object.
메타데이터
- post_id
- 3acb61fcd80c
- slug
- 1-int-compareto-compares-two-strings-lexicographically-alphabetical-order-3acb61fcd80c
- url
- https://medium.com/@kshitijkumar021991/1-int-compareto-compares-two-strings-lexicographically-alphabetical-order-3acb61fcd80c
- canonical_url
- https://medium.com/@kshitijkumar021991/1-int-compareto-compares-two-strings-lexicographically-alphabetical-order-3acb61fcd80c
- author_url
- https://medium.com/@kshitijkumar021991
- status
- ok
- fetched_at
- 2026-07-26 06:08:31