Results 1 to 3 of 3

Thread: Strings, strings, strings [resolved]

  1. #1

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935

    Strings, strings, strings [resolved]

    Let's say I have a String that contains "Line 1\nLine 2\nLine 3". How could I make it so s[0] = "Line 1", s[1] = "Line 2", etc? In VB it would be:
    VB Code:
    1. SomeStringArray = Split(TheBigString, vbCrLf)
    Last edited by filburt1; Jan 20th, 2002 at 10:57 PM.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I would just use a StringTokenizer
    Code:
    private void runThrough(String str, String delim)
    {
        StringTokenizer st = new StringTokenizer(str,delim)
    
        while(st.hasMoreTokens())
        {
            System.out.println(st.nextToken());
        }
    }
    Does it need to be an array?

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Member filburt1's Avatar
    Join Date
    Aug 1999
    Posts
    6,935
    Yeah, but I can get the rest.

Posting Permissions

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



Click Here to Expand Forum to Full Width