using replace and trim together

Discussion in 'ASP General' started by Joey, Sep 24, 2004.

  1. Joey

    Joey Guest

    This should not be this tough but I may be thinking too hard about it.

    Here's what I have:

    thenames="charles,sam,chris,"

    How do I do remove the last comma? I tried using trim and replace
    together but couldn't get it.

    Thanks!



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Joey, Sep 24, 2004
    #1
    1. Advertising

  2. if right(thenames, 1) = "," then
    thenames = left(thenames, len(thenames)-1)
    end if

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "Joey" <> wrote in message
    news:...
    > This should not be this tough but I may be thinking too hard about it.
    >
    > Here's what I have:
    >
    > thenames="charles,sam,chris,"
    >
    > How do I do remove the last comma? I tried using trim and replace
    > together but couldn't get it.
    >
    > Thanks!
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Aaron [SQL Server MVP], Sep 24, 2004
    #2
    1. Advertising

  3. Joey

    Evertjan. Guest

    Joey wrote on 24 sep 2004 in microsoft.public.inetserver.asp.general:

    > This should not be this tough but I may be thinking too hard about it.
    >
    > Here's what I have:
    >
    > thenames="charles,sam,chris,"
    >
    > How do I do remove the last comma? I tried using trim and replace
    > together but couldn't get it.
    >


    ASP jscript:

    thenames = thenames.replace(/,$/,'')

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)
    Evertjan., Sep 24, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. FAQ server
    Replies:
    0
    Views:
    138
    FAQ server
    Aug 29, 2006
  2. FAQ server
    Replies:
    0
    Views:
    135
    FAQ server
    Oct 26, 2006
  3. FAQ server
    Replies:
    6
    Views:
    213
    Jonas Raoni
    Dec 25, 2006
  4. FAQ server
    Replies:
    26
    Views:
    293
    Dr J R Stockton
    Feb 26, 2007
  5. FAQ server
    Replies:
    2
    Views:
    130
    -Lost
    Apr 24, 2007
Loading...

Share This Page