Web
Opt
tools
Configuration
First String
Second String
Locale
English (US)
Spanish (Spain)
French (France)
German (Germany)
Run Visualization
1
Console Output
>
Visual Output
First String
a
p
p
l
e
Second String
b
a
n
a
n
a
Result Explanation
Comparison Value:
-1
"apple" comes before "banana" alphabetically
Return Value Guide
-1:
First string comes before second
0:
Strings are equal
1:
First string comes after second
Method Comparison
split():
Compares two strings according to locale-specific sort order and returns -1, 0, or 1. Useful for sorting strings in a culturally correct way.