Create String from String Array [Java]
-- Coding in NetBeans IDE 4.0 Beta2 [JAVA] --
Given a String Array [saMessage] of unknown size, I need to create a String [sMessage] (so I get do a .GetBytes and send it over a Socket) that has “~” as a delimiter between each field. For example:
saMessage = [“Home”, “0001”, “UNSPECIFICED”, “192.168.0.0”]
I need this String array (this one has 4 fields) to be converted to the following String (including the delimiter “~” between each field so I can re-create it at the other end of my Socket)
sMessage = Home~0001~UNSPECIFIED~192.168.0.0~
(or something similar with the delimiters, just so that at the other end I am able to reconstruct my String Array give the string)
This makes it easier for me to manipulate each section of the string (when in the string array form I can do like saMessage = “Other”, etc…), and I need to put it in a string to do the .GetBytes function). Any ideas? (I tried playing with the String and String classes and found nothing that could help, do I need to import something?