+ Reply to Thread
Results 1 to 5 of 5

Split input string into components

  1. #1
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Split input string into components

    Hi,

    I have a form which allow the user to input an arbitrary list of numbers to a text box. The numbers in the list may be separated by a space " ", a new line ¶, or a comma "," and will contain negatives.

    I would like to be able to split the numbers up and store them in an array.
    Dose anyone have some tips for me?
    Last edited by HammerTime; 05-05-2010 at 10:41 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Split input string into components

    Replace all those with a common delimiter, then use Split to convert to a string array, test if each is numeric, and then assign to a numeric array.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: Split input string into components

    Quote Originally Posted by shg View Post
    Replace all those with a common delimiter, then use Split to convert to a string array, test if each is numeric, and then assign to a numeric array.
    I can do this bit (probably).


    Replace all those with a common delimiter,
    Is there a function for this?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Split input string into components

    Replace all those with a common delimiter,
    Is there a function for this?
    Yes, Replace()

  5. #5
    Forum Contributor
    Join Date
    08-14-2008
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: Split input string into components

    Thanks Shg, it's just too easy for you isn't it

    If anyone else want to do this here is my code. It chops an input into it's components, not specific to numbers (as mentioned above)

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1