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 - Java Tutorial
From the course: Java 11+ Essential Training
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
-
-
-
-
-
-
(Locked)
Declare and initialize string values3m 55s
-
(Locked)
Build a string from multiple values4m
-
(Locked)
Clone the exercise files from GitHub3m 57s
-
(Locked)
Convert primitive values to strings3m 29s
-
(Locked)
Format numeric values as strings5m 55s
-
(Locked)
Interpolate strings with placeholders3m 7s
-
(Locked)
Compare string values4m 27s
-
(Locked)
Parse string values2m 36s
-
(Locked)
Get string values from user input3m 34s
-
(Locked)
Challenge: A simple calculator1m 9s
-
(Locked)
Solution: A simple calculator1m 18s
-
(Locked)
-
-
-
-
-
-