Starting a new job is usually exciting but also frightening. Adjusting to a new code base --- styles, idioms, and all --- can be daunting. Luckily, for Sam, all the important code is kept in a single file: MyStuff.asp. Despite the name, the functions in that file belong to everyone.

Weighing in at only 1k lines of code, it's included by every script on the company website and contains a treasure trove of helpful functionality. It contains just about anything a web developer could want. If what you want to do is not in "The File" and it might be useful for other developers, add your function at the end. It's that simple.

From the submission:

Today I needed a function that would parse input, returning only the numeric part of a string. So, I opened up the global functions file and did a search. Lo and behold, I found what I needed. Three times.


Near the top of the file:

  Function OnlyNumber(sStr)
      Dim i, sNonNum, cChar
      sNonNum = ""
      For i = 1 To Len(sStr)
          cChar = Mid(sStr, i, 1)
          If Asc(cChar) > 47 And Asc(cChar) < 58 Then
              sNonNum = sNonNum & cChar
          End If
      OnlyNumber = sNonNum
  End Function


Towards the middle:

  Function removeNumeric(inString)
      inString = trim(inString)
          outStr = ""
          for i = 1 to len(inString)
              theDigit = Mid(inString,i,1)
              If isNumeric(theDigit) then
                  outString = outString & theDigit
              End If
      removeNumeric = outStr
  End Function


And at the end:

  Function NumStriper(str)
      ret = ""
      for i = 1 to len(str)
          if isnumeric(mid(str,i,1)) then
              ret = ret & mid(str,i,1)
          end if
      if ret = "" then
          ret = 0
      end if
      NumStripper = cdbl(ret)
  End Function


As I've always said: you can never have enough useful functions in a "standardish library," especially if many of them do about the same thing and all of them are confusingly named.