String Manipulation in java -


i have 1 array of strings. want each of string, divide in 3 parts (number-string-number), , put each part in array. @ last want have 3 arrays 2 of them store numbers , 1 of them stores strings. number of spaces between numbers , strings not fixed.

the format of strings in first array is:

-2.2052 dalam -2.7300

-3.0511 dan akan -0.1116

it great if me sample code.

here's algorithm implement :

  1. create 3 output arrays. should have same length original string array
  2. iterate through original array.
  3. for each string, find index of first space character , index of last space character. (look javadoc of string class methods doing that)
  4. extract substring before first space, substring between first , last space, , substring after last space. javadoc should you.
  5. convert first , third substring int (see javadoc double how it)
  6. store doubles , string ouput arrays.

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -