Results 1 to 2 of 2
  1. #1
    cachi is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default Can i just use toString?

    Hi, example you can split a String into a String[] with
    Java Code:
    String[] arrString = strString.split(strDelimiter);
    But how can i join this array back into a string without looping though every element, isn't there an inverse function of split, which is usually called join? Can i just use toString?

    In which case how do i do a delimiter between the joined strings.


  2. #2
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    Only way I know of doing it is to use a StringBuilder.
    Loop through each element and append it to the StringBuilder with the delimiter.

Similar Threads

  1. Inheritance, methods, and toString...
    By Kreuz14 in forum New To Java
    Replies: 1
    Last Post: 04-01-2008, 10:12 PM
  2. toString method
    By apfroggy0408 in forum New To Java
    Replies: 6
    Last Post: 01-31-2008, 04:08 AM
  3. Arrays.toString
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-01-2007, 09:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts