From the course: Java 11+ Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Parse string values

Parse string values - Java Tutorial

From the course: Java 11+ Essential Training

Start my 1-month free trial

Parse string values

- [Instructor] JAVA's string class includes many methods that you can use to parse data and find sub strings. I'm starting with a string of "Welcome to California". Let's say I wanted to find out how long that string is. I could use the length method. I'll use some system output, and then I'll pass in "length of string", and I'll uphend the expression "s1.length", and that's a method. So you use the parenthesis at the end. And I get back a numeric value of 22. If I wanted to find the location of a particular sub string, I can use the method "index of". I'll create a variable called "position", and I'll call it "s1.indexof" and pass in "California". And then I'll output that using a concatenated string. And I find out that California starts at index 11. Let's say I wanted to find out what value did start at 11. I can create a variable, I'll call it "sub". And I'll call it "s1.substring". Notice that there are two different…

Contents