Java String split String by letters

Description

Java String split String by letters

public class Main {
  public static void main(String[] args) {
    String[] items = "abc123def456ghi789".split("[a-zA-Z]+");
    for(String i:items) {
      System.out.println(">"+i+"<");  
    }/*from   w  w  w .  j av a2 s  . c o  m*/
    
  }
}



PreviousNext

Related