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

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -