08slide_2007 - Chapter 8 Strings and Text I/O EE3206/EE5805...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
EE3206/EE5805 Java Programming and Applications EE3206/EE5805 Java Programming and Applications 1 Chapter 8 Chapter 8 Strings and Text I/O Strings and Text I/O
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
EE3206/EE5805 Java Programming and Applications EE3206/EE5805 Java Programming and Applications 2 Objectives Objectives To use the String class to process fixed strings. To use the Character class to process a single character. To use the StringBuilder /StringBuffer class to process flexible strings. To know the differences between the String , StringBuilder , and StringBuffer classes. To learn how to pass strings to the main method from the command line. To discover file properties, delete and rename files using the File class. To write data to a file using the PrintWriter class. To read data from a file using the Scanner class.
Background image of page 2
EE3206/EE5805 Java Programming and Applications EE3206/EE5805 Java Programming and Applications 3 The The String String Class Class Constructing a String: – String message = "Welcome to Java“; – String message = new String("Welcome to Java“); – String s = new String(); Common string opertations Obtaining String length Retrieving Individual Characters in a string String Concatenation (concat) Substrings (substring(index), substring(start, end)) Comparisons (equals, compareTo) String Conversions Finding a Character or a Substring in a String Conversions between Strings and Arrays Converting Characters and Numeric Values to Strings
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
EE3206/EE5805 Java Programming and Applications EE3206/EE5805 Java Programming and Applications 4 java.lang.String +lastIndexOf(ch: int): int +lastIndexOf(ch: int, fromIndex: int): int +lastIndexOf(str: String): int +lastIndexOf(str: String, fromIndex: int): int +regionMatches(toffset: int, other: String, offset: int, len: int): boolean +length(): int +replace(oldChar: char, newChar: char): String +startsWith(prefix: String): boolean +subString(beginIndex: int): String +subString(beginIndex: int, endIndex: int): String +toCharArray(): char[] +toLowerCase(): String +toString(): String +toUpperCase(): String +trim(): String +copyValueOf(data: char[]): String +valueOf(c: char): String +valueOf(data: char[]): String +valueOf(d: double): String +valueOf(f: float): String +valueOf(i: int): String +valueOf(l: long): String Returns the index of the last occurrence of ch Returns the index of the last occurrence of ch before fromIndex Returns the index of the last occurrence of str Returns the index of the last occurrence of str before fromIndex Returns true if the specified subregion of this string exactly matches the specified subregion of the string argument Returns the number of characters in this string Returns a new string with oldChar replaced by newChar Returns true if this string starts with the specified prefix Returns the substring from beginIndex Returns the substring from beginIndex to endIndex-1. Returns a char array consisting characters from this string
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 43

08slide_2007 - Chapter 8 Strings and Text I/O EE3206/EE5805...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online