<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">























/** Type String: a class type, not a primitive type
  
    values: sequences of characters
      e.g. string literals:
      
      "first"    "The price is $25.00."    "5 &lt;= 20"  ""
      
      new-line character: \n
      
      "123\n4" 
      
      \  is called the ESCAPE CHARACTER.
      
      \n   \\   \"   \'
      
      "1\\2\"3" evaluates to "1\2"3" 
  
  
  
  
  
  
  
    operations: string catenation, using operator +
    
      "Store this" + " in s."   gives
      "Store this in s."
        
    Important rule:
      If one operand of + is a String, the
      other operand is converted to a String
      and catenation is performed.
        
      "three" + 1    yields    "three1"
      "three" + (1+2)    yields    "three3"
      "three" + 1 + 2    yields    "three12"

    Useful trick: catenate with empty string ""
    to turn an expression value into a string:
    
        "" + (945 - 3/2.0)    yields    "943.5"
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    Functions:
      s.length():      length of string s
      
      
      
       012345          position or index of char
      "abcdef"         length is 6, the 'f' is at 5
                       
      
      s.charAt(i):     char at position i
      
      
      s.substring(i,j) string consisting of chars
                       of s at positions in range
                       i..j-1
      s.substring(i)   string consisting of chars
                       of s at positions in range
                       i..  (to end of string)
      s.substring(0,0) empty string ""
      
      
      
      
      s.equals(s1)     = "strings s and s1 contain
                       the same sequence of chars"
      
      "abc" == "ab" + "c"       //is false!!!
      "abc".equals("ab" + "c")  //is true
                         
    
  */</pre></body></html>