114, text string in Java String class of complex secondary split

01. code is as follows:

Package TIANPAN; 

/ ** 
 * Notes document here 
 * 
 * @author Tin Pan micro-channel 382 477 247
  * / 
public  class TestDemo {
     public  static  void main (String args []) { 
        String STR = "John Doe: 20 is | John Doe: 21 | Wang Wu: 22 ";     // definition string 
        string Result [] = str.split (" \\ | ");             // first resolution 
        for ( int X = 0; X <result.length; X ++ ) { 
            String TEMP [] = Result [X] .split ( ":");         // second split 
            System.out.println ( "name:" + temp [0] + ", Age:" + temp [1]);
        }
    }
}

 

02. Results are as follows:

 

 

Knowledge has a price, if you think this article valuable, authors agree to pay, micro-channel two-dimensional code can be any amount of a reward to the author (Micro Signal: 382 477 247) Oh, thank you.

Guess you like

Origin www.cnblogs.com/tianpan2019/p/12332524.html