Sample code for 30+ languages & platforms
Classic ASP

StringBuilder ReplaceBetween

Demonstrates the ReplaceBetween method.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set sb = Server.CreateObject("Chilkat.StringBuilder")
success = sb.Append("<company><industry>Software</industry><name>Chilkat Software</name><abc>Abc Software</abc><name>Xyz Software</name></company>")

' The ReplaceBetween method restricts the replacements to only
' the parts that occur between two delimiter strings.

' For example:
numReplacements = sb.ReplaceBetween("<name>","</name>","Software","Technology")

' The number of replacements should be 2.
Response.Write "<pre>" & Server.HTMLEncode( "numReplacements = " & numReplacements) & "</pre>"

' The sb now contains:
' <company><industry>Software</industry><name>Chilkat Technology</name><abc>Abc Software</abc><name>Xyz Technology</name></company>
Response.Write "<pre>" & Server.HTMLEncode( sb.GetAsString()) & "</pre>"

%>
</body>
</html>