Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String sample = "::";
- String[] splitTime = sample.split(":");
- // extra detail omitted
- System.out.println("Value 1 :"+splitTime[0]);
- System.out.println("Value 2 :"+splitTime[1]);
- System.out.println("Value 3 :"+splitTime[2]);
- String sample = "::";
- String[] splitTime = sample.split(":", -1);
- for (int i = 0; i < splitTime.length; i++) {
- System.out.println("Value " + i + " : "" + splitTime[i] + """);
- }
- ::
- String[] splitTime = sample.split(":", 3);
- int ndx = 0;
- StringTokenizer t = new StringTokenizer(": : ::::",":");
- while (t.hasMoreElements())
- {
- System.out.println(String.format("Value %d : %s", ++ndx,t.nextElement()));
- }
Add Comment
Please, Sign In to add comment