split a string Java (At certain character) -
i'm trying split string after character 266 instance. user enters string, , if on length, spit @ (in case) 266th char. here code:
if(inputtext.length() > 266){ //max chars reached. move part 2 }
so, need takes 267th , on , sets var(p2 instance) , rest p1.
you can use substring()
split strings @ specific indexes:
if(inputtext.length() > 266){ string var1 = inputtext.substring(0, 267); string var2 = inputtext.substring(267); }
more information strings can found in javadocs.
Comments
Post a Comment