Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

copying string to string array

 
Liz Brown
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
i have a list of strings in file.
eg: values of Pid(is unique) and PC(can be more than 1)
ABC1234<space>ABCDEFGF\n
CDE2345<space>DEFGHEYT\n
---
---
10 items
i opened the file. read each line to get string in. using subsrtring i store value in string1 and string2 till end of line. i loop it till end of file.
Question is how to copy this string1 to a new string array- arr1Pid? same with string2- array arrayPc. I want to sort array_Pc. Please let me know how to do this one! thanks
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is probably easier to use Collections such as List or Set, depend on your need. If you want to keep the relationship between the PID and the PC, you might want to use Map. Those interfaces has the sorted implementation.
and you can do toArray() when you are done processing if you really need them in array format.
Check out javadoc on Collections and Map.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic