Java guides
Every published Java guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Java guides
Most readLatest Java guides
Page 90 of 109Java 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.
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 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.
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+.
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.
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.
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.
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.
Java String Contains: Checking Substrings Safely
Check for substrings in Java with String.contains: understand null and empty arguments, case sensitivity, and when to use indexOf or matches instead.
Java replace vs replaceAll: Literal Text vs Regex
Java's replace() matches literal text, while replaceAll() takes a regex. Includes replacement-string escaping, Matcher.quoteReplacement(), Pattern.quote(), and precompiling patterns.