(Classic ASP) StringBuilder GetEncoded
Demonstrates the Chilkat StringBuilder GetEncoded method.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
s = "The quick brown fox jumps over the lazy dog"
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sb = Server.CreateObject("Chilkat.StringBuilder")
success = sb.Append(s)
' output: The quick brown fox jumps over the lazy dog
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"
' Get the string encoded to base64, without changing the contents of sb.
' output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
Response.Write "<pre>" & Server.HTMLEncode( sb.GetEncoded("base64","utf-8")) & "</pre>"
' The contents of sb are not changed..
' output: The quick brown fox jumps over the lazy dog
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"
%>
</body>
</html>
|