There is already a thread like this, but it was filled with alot of general chit-chat and stuff, so I decided to start a new one. Please, keep chat to a minimal, just post your functions os other peopel can easily use them without siffing thru chat.

Thanks



Code:
<%
Function changeDate(timeStr,loc)
	splitterThingy = "/"
	firstSlashPos = inStr(timeStr, splitterThingy)
	secSlashPos = inStr(firstSlashPos, timeStr, splitterThingy)
	yearSlashPos = inStr(secSlashPos + 1, timeStr, splitterThingy)
	firstInfo = left(timeStr,(firstSlashPos - 1))
	secInfo = mid(timeStr,firstSlashPos+1,(secSlashPos - 1))
	yearInfo = mid(timeStr, (yearSlashPos + 1), len(timeStr))
	If loc = "us" then
		changeDate = secInfo & splitterThingy & firstInfo & splitterThingy & yearInfo
	elseIf loc = "uk" then
		changeDate = firstInfo & splitterThingy & secInfo & splitterThingy & yearInfo
	end if
end function
response.write(changeDate("05/09/2001","us"))
%>
Chages date UK -> US or US -> UK

Code:
function chkEmail(theAddress)
   dim atCnt
   chkEmail = theAddress
   if len(theAddress) < 5  then 
      chkEmail = 1
    elseif instr(theAddress,"@") = 0 then
      chkEmail = 1
   elseif instr(theAddress,".") = 0 then
      chkEmail = 1
   elseif len(theAddress) - instrrev(theAddress,".") > 3 then
      chkEmail = 1
   elseif instr(theAddress,"_") <> 0 and _
       instrrev(theAddress,"_") > instrrev(theAddress,"@")  then
      chkEmail = 1
   else
      atCnt = 0
      for i = 1 to len(theAddress)
         if  mid(theAddress,i,1) = "@" then
            atCnt = atCnt + 1
         end if
      next
      if atCnt > 1 then
         chkEmail = 1
      end if
      for i = 1 to len(theAddress)
        if  not isnumeric(mid(theAddress,i,1)) and _
		(lcase(mid(theAddress,i,1)) < "a" or _
		lcase(mid(theAddress,i,1)) > "z") and _
		mid(theAddress,i,1) <> "_" and _
		mid(theAddress,i,1) <> "." and _
		mid(theAddress,i,1) <> "@" and _
		mid(theAddress,i,1) <> "-" then
            chkEmail = 1
        end if
      next
  end if
end function
Non-RegExp way of validating an e-mail address

Code:
Function chkEmail(sEmail)
	Set objRegExp = New RegExp
	searchStr = "^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$" 
	objRegExp.Pattern = searchStr
	objRegExp.IgnoreCase = true
	chkEmail = objRegExp.Test(sEmail)
End Function
A RegExp way of validating an e-mail address

Code:
<%
if isempty(request.querystring("PageNo")) then
	CurrPage = 1
else
	CurrPage = cint(request.querystring("PageNo"))
end if
Set RS = Server.CreateObject("ADODB.Recordset")
RS.CursorLocation = 3
RS.Open "SQL statement", connectString
RS.PageSize = 3
RS.AbsolutePage = CurrPage
DO UNTIL RS.AbsolutePage <> CurrPage OR RS.EOF
	' Write stuff to page
Loop

function getNext10(num)
	pageLen = len(num)
	if pageLen = 1 then
		next10 = 10
	elseif pageLen = 2 then
		pageRem = 10
		pageTen = right(num, 1)
		next10 = num + pageRem - pageTen
	elseif pageLen > 2 then
		pageRem = 10
		pageTen = right(num, 1)
		next10 = num + pageRem - pageTen
	end if
	getNext10 = next10
end function

function getPrev10(num)
	pageLen = len(num)
	if pageLen = 1 then
		prev10 = 1
	elseif pageLen = 2 then
		firstDig = left(num, 1)
		secondDig = right(num, 1)
		prev10 = num - secondDig - 10
	elseif pageLen > 2 then
		firstDig = right(num, 2)
		secondDig = right(num, 1)
		prev10 = num - secondDig - 10
	end if
	if prev10 = 0 then
		prev10 = 1
	end if
	getPrev10 = prev10
end function

RSPrevPage = CurrPage -1
RSNextPage = CurrPage + 1
next10 = getNext10(currPage)
prev10 = getPrev10(currPage)

if Next10 > RS.PageCount then
	next10 = RS.PageCount
end if

if prev10 = 1 AND next10 - 1 < 10 then
	start = 1
else
	start = Next10 - 10
if right(start, 1) > 0 then
	start = replace(start, right(start, 1), "0")
	start = start + 10
end if
end if

if RS.PageCount > 1 then
	if next10 > 10 then
		response.write("<p class=""para1""><a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & Prev10 & """><<</a>   ")
	end if
	if not RSPrevPage = 0 then
		response.write("<a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & RSPrevPage & """><</a>   ")
	end if
	for P = start to Next10
		if not P = CurrPage then
			response.write("<a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & P & """>" & P & "</a> ")
		else
			response.write(" <b>" & P & " </b>")
		end if
	Next
	
	if not RSNextPage > RS.PageCount then
		response.write("<a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & RSNextPage & """>></a>  ")
	end if
	if not Next10 = RS.PageCount then
		response.write("   <a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & Next10 & """>>></a>")
	end if
end if
An RS Paging Technique


I will post some more soon.