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
Post a Comment