Replace comma

Results 1 to 2 of 2

Thread: Replace comma

  1. #1
    Join Date
    Dec 1969

    Default Replace comma

    I have a string with multible comma&#039s. I only want to replace the last one. I&#039ve tried "Replace" but it steals part of the string. I&#039ve tried a "Do Loop" with "Mid" but nothing gets replaced. <BR><BR>sNum=Replace(sqlQuery,",","")<BR><BR>Do<BR >sNum = InStr(sqlQuery,Chr(41))<BR>If sNum &#062; 0 then Mid(sqlQuery, sNum) = ""<BR>Loop Until sNum = 0<BR><BR>Thanks Wayne<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Replace comma

    I would try something like this...<BR><BR>strVariable = "2,3,5,7,,8,9"<BR><BR>strVarReverse = strReverse(strVariable)<BR><BR>intLastComma = Instr(strVarReverse, ",")<BR><BR>strNewVariable = Left(strVariable, Len(strVariable)-intLastComma)<BR>strNewVariable = strNewVariable & Mid(strVariable, Len(strVariable)-intLastComma + 2)<BR><BR>Response.Write strNewVariable<BR><BR>HTH<BR><BR>Jerry<BR><BR><BR>

Posting Permissions

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