Java String split String by digit

Description

Java String split String by digit

public class Main {
  public static void main(String[] args) {
    String[] items = "abc123def456ghi789".split("\\d+");
    for(String i:items) {
      System.out.println(">"+i+"<");  
    }//from  ww  w  .  j a va  2s .  co  m
    
  }
}



PreviousNext

Related