Ask a Question related to ASP, Design and Development.

  1. #1

    Default Replace

    Hi,

    Just wanted to check that I'm doing things the right way..........

    I need to create a string along the lines of "23,43,78,23" with no comma at
    the beginning or end of it. The data comes out of a table so i've created a
    loop to get the data and form the string :

    StrRecip = "," & objRS("number") & StrRecip

    This will give me something like : ",42,78,67,2,90"

    And then I've removed the leading comma :

    StrRecipRem = replace(StrRecip, ",", "", 1, 1)

    Is there actually a better way ?

    Thanks

    J.





    John Smith Guest

  2. Similar Questions and Discussions

    1. help with the replace(pattern, replace)
      hii i hope you can help me, i want to replace two parameters on the same replace, the idea it's print in a textArea a XML file from a webService,...
    2. Replace into..??
      Hallo Group, is there an equivelant/replacement of the MySQL Command "Replace Into" for Access/MS SQLServer? "Replace Into" does either...
    3. Search and replace (super global replace)
      I am using the 30 day trail of acrobate professional....before I buy it I have a few questions.... 1) is there a "search and replace" function...
    4. SQL Replace
      I've looked at BOL and through dejanews for a solution (similar post from Lamine Darbouche on 30th July in this group) but cannot find a solution....
    5. Replace in ASP/VBS/SQL
      I need to replace all occurancies of "is" in "This is a test (is), is, penis." with "<a href=is.htm>is</a>". The thing is, if I use a simple...
  3. #2

    Default Re: Replace

    That'll work, or you can do something like right(var, len(var) - 1). It'll
    all be about the same. Another thing that you may want to look at though is
    the getstring method of the recordset object. If you are only pulling in
    the "number" column in your recordset, you can grab all the values at once
    from the recordset with them all comma delimited, then close and destroy the
    rs immediately without having to loop through it. Take a look here,
    [url]http://msdn.microsoft.com/library/en-us/ado270/htm/mdamth02_11.asp[/url] and post
    back if you have questions.

    Ray at home

    "John Smith" <john@smith.com> wrote in message
    news:bn8rs5$ii3$1@hercules.btinternet.com...
    > Hi,
    >
    > Just wanted to check that I'm doing things the right way..........
    >
    > I need to create a string along the lines of "23,43,78,23" with no comma
    at
    > the beginning or end of it. The data comes out of a table so i've created
    a
    > loop to get the data and form the string :
    >
    > StrRecip = "," & objRS("number") & StrRecip
    >
    > This will give me something like : ",42,78,67,2,90"
    >
    > And then I've removed the leading comma :
    >
    > StrRecipRem = replace(StrRecip, ",", "", 1, 1)
    >
    > Is there actually a better way ?
    >
    > Thanks
    >
    > J.
    >
    >
    >
    >
    >

    Ray at Guest

  4. #3

    Default Re: Replace

    "John Smith" <john@smith.com> wrote in message
    news:bn8rs5$ii3$1@hercules.btinternet.com...
    .. . .
    > I need to create a string along the lines of "23,43,78,23" with no
    > comma at the beginning or end of it. The data comes out of a table
    > so i've created a loop to get the data and form the string :
    .. . .
    > This will give me something like : ",42,78,67,2,90"
    >
    > And then I've removed the leading comma :
    StrRecipRem = Mid( StrRecip, 2 )

    HTH,
    Phill W.


    Phill. W Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139