Characters & Strings Code Samples
Learn how to use characters and strings in applications written in the Java programming language.
- Append.java shows you how to append a string onto another string. For supporting information see New to Java Programming Supplement, November 2001.
- BostonAccentDemo.java uses the replace method to translate a string into the Bostonian accent. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- CaseofStrings.java shows you how to create a case statement to handle strings. For supporting information see New to Java Programming Supplement, September 2001.
- Charactertest.java demonstrates some of the Character class methods. For supporting information see New to Java Programming Supplement, May 2002.
- CopyFile.java shows you how to copy a file. For supporting information see New to Java Programming Supplement, December 2001.
- Examine.java examines each character submitted to it from a command line argument. For supporting information see New to Java Programming Supplement, May 2002.
- Filename.java illustrates the use of lastIndexOf and substring to isolate different parts of a file name. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- FilenameDemo.java constructs a Filename object and calls all its methods. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- InsertDemo.java uses the insert method to insert a string into a string buffer. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- ItemsListing.java shows you how to convert variable data to a string. For supporting information see New to Java Programming Supplement, August 2001.
- Palindrome.java determines whether a string is a palindrome (a word, phrase, or sentence that reads the same forwards and backwards). For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- RegionMatchesDemo.java uses the regionMatches method to search for a string within another string. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- StringsDemo.java reverses the characters of a string using both a string and a string buffer. For supporting information see The Java Tutorial: Object Basics and Simple Data Objects.
- UsingStringBuffers.java shows you how to convert variable data to a string. For supporting information see New to Java Programming Supplement, November 2001.