java - How to parse a string with no delimiter? -


i have frame want parse. string, , fields have no delimiters, , have different lengths. how can fields (using java)?

for example frame: $xxyyyu#

how can content of fields 'xx', 'yyy' , 'u' ?

thanks!

if know lengths consistent, can try substring method of string.

for instance:

package test;  public class main {      public static void main(string[] args) {         string mystring = "$xxyyyu#";         string xx = mystring.substring(1, 3);         string yyy = mystring.substring(3, 6);         string u = mystring.substring(6, 7);         system.out.println(xx + " " + yyy + " " + u);      } } 

output:

xx yyy u 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -