Skip to content
Veltoryx Technologies
ProLesson 3.3Beginner2 min readUpdated 30 October 2026

Common String methods

The String methods you'll use every day, for searching, cutting, replacing, splitting and joining text, with small real examples.

You don't need to memorise the whole String API. These methods cover nearly everything you'll do with text at work and in coding rounds.

01Searching

Search.java
public class Search {
    public static void main(String[] args) {
        String email = "asha.rao@veltoryx.dev";
        System.out.println(email.contains("@"));
        System.out.println(email.indexOf('@'));          // first position, or -1
        System.out.println(email.lastIndexOf('.'));
        System.out.println(email.startsWith("asha"));
        System.out.println(email.endsWith(".dev"));
    }
}
Expected output
true
8
17
true
true

Loading the rest of the lesson…