String Methods

java dev.to

1. trim() Removes extra spaces only at the beginning and end. Example String s=" Admin123 "; System.out.println(s.trim()); // output:"Admin123" 2.equalsIgnoreCase() Compares two strings ignoring uppercase/lowercase. Example "Vijay".equalsIgnoreCase("vijay"); // true 3.equals() vs == == checks memory reference(same object or not). equals() checks actual content/value. Example String s1="java"; String s2

Read Full Tutorial open_in_new
arrow_back Back to Tutorials