/*****************************************************************
** DemoStringMethods - demonstrate common string methods
**
** The following string methods are demonstated:
**
**    length()       - return the lenght of a string
**    toUpperCase()  - convert a string to uppercase characters
**    toLowerCase()  - convert a string to lowercase characters
**    substring()    - extract a substring from a string
**    charAt()       - extract a single character from a string
**    indexOf()      - return the index of a specified character
**    compareTo()    - return the lexical difference between string
**
** This program generates the following output:
**
**    12
**    world
**    HELLO, WORLD
**    hello, world
**    w
**    3
**    35
**    -1
**    false
**
** (c) Scott MacKenzie, 2000                             
******************************************************************/
public class DemoStringMethods
{
   public static void main(String[] args)
   {
      String s1 = new String("Hello, world");
      String s2 = "$75.35";
      String s3 = "cat";
      String s4 = "dog";

      System.out.println(s1.length());
      System.out.println(s1.substring(7, 12));
      System.out.println(s1.toUpperCase());
      System.out.println(s1.toLowerCase());
      System.out.println(s1.charAt(7));
      System.out.println(s2.indexOf("."));
      System.out.println(s2.substring(s2.indexOf(".") + 1, s2.length()));
      System.out.println(s3.compareTo(s4));
      System.out.println(s3.equals(s4));
   }
}

