Java - Split String by Number and Letters

前端 未结 10 1794
春和景丽
春和景丽 2020-12-05 20:14

So I have, for example, a string such as this C3H20IO

What I wanna do is split this string so I get the following:

Array1 = {C,H,I,O}
Ar         


        
10条回答
  •  一向
    一向 (楼主)
    2020-12-05 20:53

    make (for loop) with size of input length and add following condition

    if(i==number)
    // add it to the number array
    
    if(i==character)
    //add it into character array
    

提交回复
热议问题