<%
dim a
a = "Help Me! Trapped in computer"
' append ", can't get out" to the end of string a
Response.Write AddChr(a, ", can't get out", Len(a)) & "<BR>"
' returns: "Help Me! Trapped in computer, can't get out"
' write ", can't get out" to the tenth position from the
' right of string a and append everything after that position to the end
Response.Write AddChr(a, ", can't get out", Len(a) - 10) & "<BR>"
' returns: "Help Me! Trapped i, can't get outn computer"
' write ", can't get out" before string a and append everything
' after that position to the end
Response.Write AddChr(a, ", can't get out", 0) & "<BR>"
' returns: ", can't get outHelp Me! Trapped in computer"
%>
<%
Private Function AddChr(byVal string, byVal addition, byVal location)
Dim leftString, rightString
On Error Resume Next
leftString = Left(string, location)
If Err Then
leftString = ""
location = 0
End If
rightString = Mid(string, location + 1)
AddChr = leftString & addition & rightString
On Error GoTo 0
End Function
%>