Skip to content

Instantly share code, notes, and snippets.

@gwobcke
gwobcke / string-functions.asp
Last active May 3, 2020 03:08
A simple collection of string functions in Classic ASP
<%
'//////////////////////////////////////////////////
'//
'//
'//
'//////////////////////////////////////////////////
Function MixedCase(strInput)
Dim strPos, strSpace, strOutput
strPosition = 1
@gwobcke
gwobcke / URLDecode.asp
Last active June 21, 2023 09:38
ASP seems to lack a URL Decode function but has a URL Encode function available. Here is a function that can decode any URL Encoded URL or variable.
<%
FUNCTION URLDecoder(str)
'// This function:
'// - decodes any utf-8 encoded characters into unicode characters eg. (%C3%A5 = å)
'// - replaces any plus sign separators with a space character
'//
'// IMPORTANT:
'// Your webpage must use the UTF-8 character set. Easiest method is to use this META tag:
'// <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
'//
@gwobcke
gwobcke / checkIfInArray.asp
Last active October 4, 2022 12:42
Classic ASP Check If In Array
<%
Function in_array(element, arr, performTrim)
Dim i
in_array = False
For i=0 To Ubound(arr)
If performTrim Then '//there are some scenarios where you want to trim
If Trim(arr(i)) = Trim(element) Then
in_array = True
Exit Function
End If
@gwobcke
gwobcke / gist:1044225
Created June 24, 2011 04:31
Example of .625 sizing
body { font-size: 16px;}
p { font-size: 1.5em; /* 1.5em = 24px = 18pt */}
h1 { font-size: 200%; /* 200% = 32px = 24pt */}
@gwobcke
gwobcke / scrapeURL.asp
Created June 15, 2011 13:57
Classic ASP Scrape External URL
<%
FUNCTION LoadThePage(strPageText, strInputURL)
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "GET", strInputURL, False
objXMLHTTP.Send
strPageText = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
End FUNCTION
FUNCTION GrabTheContent(strStart, strEnd)
@gwobcke
gwobcke / stripStringHTML.asp
Created June 15, 2011 13:51
Classic ASP Strip HTML Function
<%
FUNCTION stripHTML(strHTML)
Dim objRegExp, strOutput, tempStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|n)+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with &lt; and &gt;