Results 1 to 7 of 7

Thread: Splitting a string that has no delimeter (or regex)

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Re: Splitting a string that has no delimeter (or regex)

    Can't you just iterate through the string and use each character individually?
    How would i do this?

  2. #2
    New Member
    Join Date
    Dec 2005
    Posts
    5

    Re: Splitting a string that has no delimeter (or regex)

    int i = 0;

    while (String.length<i);
    {
    System.out.println(i);
    i++;
    }


    ok, so that's dirty code that won't work but it should give you an idea of the structure. You may need to input the text into an array list

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Splitting a string that has no delimeter (or regex)

    Quote Originally Posted by x-ice
    How would i do this?
    Use toCharArray() to covert it to a character array...

    Code:
      char[] chars = "football".toCharArray();
            
      for (int x=0; x<chars.length; x++) 
        System.out.println(chars[x]);
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

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