/home/ssingh6/NetBeansProjects/CS1/src/stringthing/StringOps.java
 1 /*
 2  * To change this license header, choose License Headers in Project Properties.
 3  * To change this template file, choose Tools | Templates
 4  * and open the template in the editor.
 5  */
 6 package stringthing;
 7 
 8 /**
 9  *
10  * @author ssingh6
11  */
12 public class StringOps {
13 
14     /**
15      * @param args the command line arguments
16      */
17     public static void main(String[] args) {
18         //ESTABLISH SOME STRINGS
19         String date= "Thursday , October 11, 2018";
20         String time= "  11:30 AM";
21         String lab = "String Thing";
22         
23         //COMPUTE THE LENGTHS OF THE STRINGS
24         int dateLength= date.length();
25         int timeLength= time.length();
26         int labLength=lab.length();
27         System.out.println("\ndateLength="+dateLength);
28         System.out.println("timeLength="+timeLength);
29         System.out.println("labLength="+labLength);
30         
31         //COMPUTE SOME POSITIONS
32         int p1= date.indexOf(",");
33         int p2= date.indexOf("");
34         int p3= lab.indexOf("ing");
35         System.out.println("\np1= "+ p1);
36         System.out.println("p2= " + p2);
37         System.out.println("p3= "+  p3);
38         
39         // COMPUTE SOME 2 ARGUMENT SUBSTRING VALUES
40         System.out.println("\ndate.substring(0,9)= " + date.substring(0,9));
41         System.out.println("time.substring(2,4)=" + time.substring(2,4));
42          System.out.println("lab.substring(7,8)=" + lab.substring(7,8));
43          
44          // COMPUTE SOME 1 ARGUMENT SUBSTRING VALUES
45          System.out.println("\ndate.substring(11)= "+ date.substring(11));
46         System.out.println("time.substring(2)=" + time.substring(2));
47          System.out.println("lab.substring(7)=" + lab.substring(7));
48          
49          //CREATE A STRING
50          String line = date +" | " + time+ " | " + lab;
51          System.out.println("\nline = " + line);
52     }
53 }
54          
55         
56         
57