Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Left, Right, Mid, StrCompDemonstrates the Left, Right, Mid, and StrComp functions.
The Chilkat ASP String Component is freeware and may be used in any ASP application. To install, download and unzip the ASP String Component. Then copy the CkString.dll to a directory on your ASP Web Server and register it with regsvr32.exe.
<% @CodePage = 65001 %>
<% Response.CodePage = 65001 %>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<%
' The ASP String component (CkString) can be downloaded from:
' http://www.chilkatsoft.com/download/CkString.zip
set cks = Server.CreateObject("CkString.CkString")
' Left, Right, Mid, StrComp
cks.Str = "123-ABC-XYZ"
' Indexing begins at 0.
' Prints the 3 leftmost characters of the string: 123
Response.Write cks.Left(3) & "<br>"
' Prints the 3 rightmost characters of the string: XYZ
Response.Write cks.Right(3) & "<br>"
' Prints the 3 characters starting at position 4: ABC
Response.Write cks.Mid(4,3) & "<br>"
' StrComp is a string comparison:
' Return 1 for greater than (caller string is lexicographically greater than argument)
' Return 0 for equal.
' Return -1 for less than (caller string is lexicographically less than argument)
cks.Str = "chilkat"
caseSensitive = 0
Response.Write CStr(cks.StrComp("aaa",caseSensitive)) & "<br>"
Response.Write CStr(cks.StrComp("chilkat",caseSensitive)) & "<br>"
Response.Write CStr(cks.StrComp("zzz",caseSensitive)) & "<br>"
%>
</body>
</html>
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.