티스토리 뷰

java split // 문자열 자르기

Class.

  String.

 Example.

 public class examSpilt{

             public static void main ( String args[] ){

                   String phone = "123-456-789";

                  String[] phoneArray = phone.split("-");

             

                  for( String phoneNum : phoneArray )

                        System.out.print( phoneNum ); 

            }                 
}

 output

 123456789