Working with Strings

A String is a unique data type. In some ways, it feels like a primitive data type, such as an int, or a char. This is because we often declare a String the same way we do an int. int age = 32; String name = "Larry"; But strings are not primitive data types. Rather, they are objects that contain an array of characters (char[]). The String class contains numerous methods that allow for the manipulation and examination of these characters. This section covers essential string methods to provide you with the skills to handle text data effectively.

Updated

Working with Strings

  1. Understanding the String Class (Novice): A Java String is a sequence of characters that can't be changed once it's made, so every change creates a new string.
  2. Useful String Methods (Apprentice): Find, cut, change case and split text with the String methods indexOf, lastIndexOf, substring, toLowerCase, toUpperCase and split.
  3. Common Tasks (Apprentice): Input text rarely arrives in the format you need, so developers reformat it every day, by trimming, splitting, joining, searching, padding, replacing and reversing.