Pages

Topics

Tools

↑↓navigate↵openescclose

All syntax guides

Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.

3,980 guides across 14 topics

Topics

Latest guides

Illustration of Java string comparison using equals method versus reference equality
Java

Java String equals: Compare Strings Correctly

java string equals: Learn how to compare strings in Java using equals, equalsIgnoreCase, and related methods, and avoid common pitfalls with == and null handling.

string comparisonequals methodJava programmingnull safety
Illustration of uppercase 'I' transforming to lowercase 'i' with a globe icon representing locale-dependent behavior in Java's String.toLowerCase() method.
Java

Java String toLowerCase: Usage and Locale Pitfalls

Understand how Java's String.toLowerCase() works, why the no-argument version uses the default locale, and when to pass an explicit Locale for deterministic case conversion.

String manipulationLocale handlingJava core APIsCase conversion
Diagram showing how Java String toUpperCase() converts lowercase characters to uppercase while preserving the original immutable string
Java

Java String toUpperCase(): Usage, Locale, and Edge Cases

Learn how Java's String.toUpperCase() works, why locale matters, and how to avoid common pitfalls with case conversion in production code.

javastringlocaleunicode
A visual comparison of Java's trim() and strip() methods, showing ASCII-only whitespace removal versus Unicode whitespace removal.
Java

Java trim vs strip: Key Differences Explained

Understand the difference between Java's trim() and strip() methods, including Unicode whitespace handling, performance, and when to use each.

Java StringUnicode whitespaceString manipulationJava 11
Illustration showing Java String.strip() removing Unicode whitespace characters from both ends of a string, contrasted with trim() leaving them in place.
Java

Java String strip: Removing Unicode Whitespace

Learn how Java's String.strip() removes Unicode whitespace, how it differs from trim(), and when to use each method in practice.

javastring-manipulationunicodejava-11
Illustration of a Java String being trimmed of leading and trailing spaces, showing the trim() method concept.
Java

Java String trim: Remove Leading and Trailing Whitespace

Java's String.trim() removes leading and trailing ASCII whitespace. See how it works, its edge cases, and how it differs from strip() in Java 11+.

JavaStringwhitespacetrim
Illustration of a Java string with a backward arrow pointing to the last occurrence of a character, representing the lastIndexOf method.
Java

Java String lastIndexOf: Usage and Edge Cases

Learn how to use Java String lastIndexOf effectively: overloads, backward search behavior, fromIndex handling, edge cases, and performance considerations.

JavaStringlastIndexOfString search
Diagram showing a magnifying glass scanning along a horizontal string bar with a highlighted character position marker
Java

Java String indexOf: Usage and Edge Cases

Learn how Java's String.indexOf() searches for characters and substrings, returns -1 for missing matches, and handles overloads and edge cases.

String methodsindexOfJava stringssubstring search
Diagram showing a Java string ending with a suffix, illustrating the endsWith method check.
Java

Java String endsWith: Syntax, Edge Cases, Performance

Learn how Java's String.endsWith() method checks suffixes: syntax, case sensitivity, null and empty suffixes, case-insensitive alternatives, and performance tradeoffs.

javastringendsWithsuffix
Java code snippet showing a string being checked with startsWith, with a magnifying glass highlighting the prefix comparison.
Java

Java String startsWith: Syntax and Common Pitfalls

java string startswith: Learn how to use Java String startsWith for prefix checks, including offset, case sensitivity, edge cases, and performance considerations.

JavaStringstartsWithString Comparison