











































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of various methods and operations related to strings in java. Topics covered include creating string objects, testing strings for equality, comparing strings, locating things in strings, extracting substrings, changing strings, and other string methods. The document also includes examples of string manipulation using the docsity.com platform.
Typology: Slides
1 / 51
This page cannot be seen from the preview
Don't miss anything!
String color = "blue";
String s1 = new String("hello ");
char chs[] = {‘a’, ‘n’, ‘d’, ‘y’}; String s2 = new String(chs);
String s3 = s1 + s2 + " davison"; // + is string concatenation
Four different ways (there are more). 1
2
"hello "
s
continued Docsity.com
for text analysis
String w = "foo"; String newW = w + "bar"; w = newW;
String w = "foo"; w = w + "bar";
"foo"
w
String[] msgs = new String[2];
msgs[0] = "hello";
msgs[1] = new String("hi");
String t = msgs[1];
t.toLowerCase();
msgs[1].toLowerCase();
t = msgs[1].toLowerCase();
What is built?
What is changed?
Input
Processing
Response
InputReader
Responder
SupportSystem
printWelcome();
String line, response boolean finished = false; while (!finished) { line = inputReader.getInput( ); if (line.startsWith("bye")) // time to stop finished = true; else { response = responder.genResponse (line) System.out.println( response ); } } printGoodbye();
Input
Processing and Response
InputReader
Responder