Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    remove commas and space in a string

    hi..i need some help...

    let say i got a string:

    apple, orange, durian

    question:

    1. how to check got how many commas in this string?
    2. how to check beside the commas is space or not space?
    3. if the words beside the commas is space, i wan to remove the space?
    4. if the words got commas, i have to remove the space


    i need help ..urgent..plz help..thanx

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Code:
    <&#37;
    strWords = "apple, orange,durian"
    strWords = replace(strWords, ", ", ",") ' replace comma+space with just comma
    aryWords = split(strWords, ",")
    for i = 0 to uBound(aryWords )
    response.write("<br/>" & aryWords(i))
    next
    %>
    Last edited by Spudhead; 01-11-2008 at 11:18 AM. Reason: missed a bit, innit


  •  

    Posting Permissions

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