Results 1 to 5 of 5

Thread: Split string? [Resolved]

  1. #1

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Question Split string? [Resolved]

    How can I split text inside a Textbox into a few strings, where each string can only contains exactly 5 characters?

    How to avoid splitting a word into 2? for example:
    origianal text is: "ONE HUNDRED NINETY"
    after spliting:
    1st string: "ONE H"
    2nd string: "UNDRE"
    3rd string: "D NIN"
    4th string: "ETY"
    can it detect is it's a word, it would not split it into 2? means it will stop at the space before the word, and push the word to next new string?

    pls guide thank you
    Last edited by albertlse; Aug 21st, 2003 at 07:55 PM.

  2. #2
    Lively Member morrowasted's Avatar
    Join Date
    Aug 2003
    Location
    Houston, TX
    Posts
    118
    ummm...
    do the strings have to be variables or do you just want the text seperated?

    -morrowasted

  3. #3

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163
    do the strings have to be variables or do you just want the text seperated?
    which approach will be better? array of string? or how? pls suggest...

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by albertlse
    which approach will be better? array of string? or how? pls suggest...
    VB Code:
    1. Public MyStrings As String() = Regex.Split(TextBox, " ")
    That will put text into the arrow seperating them by strings.

    Hope that helps

  5. #5

    Thread Starter
    Registered User
    Join Date
    Apr 2003
    Location
    Klang, Selangor, Malaysia
    Posts
    163

    Thumbs up

    it's working fine now.... thanx

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