I'm pretty sure we've all heard of NIH ("Not Invented Here") before. But I'll be willing to bet that you haven't heard of IHBLRIA ("Invented Here, But Let's Reinvent It Anyway"). And it you have, that's quite impressive; I just made it up right now.

Today's post is a perfect example of IHBLRIA. From the creators of the Replace() function, here is the solution for Knowledge Base Article 190742, as discovered by Kris:

   Function padQuotes( instring )
     REM This function pads an extra single quote in strings containing quotes for  
     REM proper SQL searching.
     Dim bodybuild
     Dim bodystring
     Dim Length
     Dim i
     bodybuild = ""
     bodystring = instring
     Length = Len(bodystring)
     For i = 1 to length
       bodybuild = bodybuild & Mid(bodystring, i, 1)
       If Mid(bodystring, i, 1) = Chr(39) Then
          bodybuild = bodybuild & Mid(bodystring, i, 1)
       End If
     bodystring = bodybuild
     padQuotes = bodystring
   End Function

Well, at least it isn't as dangerous as some sample code (Example C) I've run across or as ridiculous as some constructs in other platforms.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!