Replacing quotes when submitting a form

Results 1 to 4 of 4

Thread: Replacing quotes when submitting a form

  1. #1
    Jason Massie Guest

    Default Replacing quotes when submitting a form

    I need to replace single and double quotes when submitting a form. I can replace the single quotes with.<BR>purpose=replace(purpose,"&#039","&#039&#0 39")<BR>but when I try to replace dbl quote with the same basic code it doesn&#039t like it.<BR>purpose=replace(purpose,""","&#039&#039")<B R>Any Ideas. <BR><BR>Jason

  2. #2
    Join Date
    Dec 1969

    Default RE: Replacing quotes when submitting a form

    This little beauty will do both for you, enjoy<BR><BR>Function Checkstring(sVal)<BR> Dim sOutVal1, sOutVal2<BR> sOutVal1 = ""<BR> If instr(sVal,chr(34))&#062;0 then<BR> sOutval1 = replace(sVal,chr(34),"")<BR> Else if instr(sVal,chr(39))&#062;0 then<BR> sOutval1 = replace(sVal,chr(39),"")<BR> Else<BR> sOutval1 = sVal<BR> End if<BR> End if<BR> <BR> If instr(sOutVal1,chr(34))&#062;0 then<BR> sOutval2 = replace(sOutVal1,chr(34),"")<BR> Else if instr(sOutVal1,chr(39))&#062;0 then<BR> sOutval2 = replace(sOutVal1,chr(39),"")<BR> Else<BR> sOutval2 = sOutVal1<BR> End if<BR> End if<BR><BR> Checkstring = sOutVal2<BR>End Function

  3. #3
    Join Date
    Dec 1969

    Default RE: Replacing quotes when submitting a form

    Try using chr(34). That&#039s the ASCII number for double quotes.<BR><BR>puprose = replace(purpose, chr(34), &#060;replacement character&#062;)

  4. #4
    Smitty Guest

    Default RE: Replacing quotes when submitting a form

    This function will replace a string with another string. Simply add more Double qutes to accomplish the conversion.<BR><BR>&#039 Original Call: Replace single with double glitch<BR>strTextLine = ReplaceStr(strTextLine, "&#039", "&#039&#039", 0)<BR><BR>&#039 Your Request: Replace Double Quote with Double, Double Quote<BR>strtextline = ReplaceStr(strtextline, """", """""", 0)<BR><BR>Function ReplaceStr(TextIn, SearchStr, Replacement, CompMode)<BR> Dim WorkText, Pointer<BR> If IsNull(TextIn) Then<BR> ReplaceStr = Null<BR> Else<BR> WorkText = TextIn<BR> Pointer = InStr(1, WorkText, SearchStr, CompMode)<BR> Do While Pointer &#062; 0<BR> WorkText = Left(WorkText, Pointer - 1) & Replacement & Mid(WorkText, Pointer + Len(SearchStr))<BR> Pointer = InStr(Pointer + Len(Replacement), WorkText, SearchStr, CompMode)<BR> Loop<BR> ReplaceStr = WorkText<BR> End If<BR>End Function<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