Strip last comma

Results 1 to 2 of 2

Thread: Strip last comma

  1. #1
    bart_bart Guest

    Default Strip last comma

    Hi-<BR><BR>I want to retrieve text values from a database and place them in an array to build a dynamic select statement series. The problem I&#039m having is in trying to replace/drop the final comma in the string. I made the string variable contiguous by replacing all spaces with a percent sign. <BR><BR>while Noe objRec.eof<BR>PlaceHolder = PlaceHolder & objRec.Fields("Name") & ""<BR><BR><BR>Placeholder = Bart%N,Brad%N,Kurt%N,<BR><BR>myString = Replace(Placeholder,","," ",56,1,0)<BR> ^<BR> &#124 <BR> proper syntax? ","<BR><BR>I&#039ve read the different Vbscript texts and the MS site documentatuion but they seem skinny.<BR><BR>Thanks!<BR><BR>Bart<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Strip last comma

    If I understand correctly, you&#039re really interested in stripping the last character (since, in this case, it will always be a comma).<BR><BR>So, run a simple Left() on it after you&#039re finished building it:<BR><BR>Left(Placeholder,Len(Placeholder)-1)<BR><BR>Kurt

Posting Permissions

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