Draft for Information Only
Content
Knowledge Base: Examples of Recursion Recursively Removal of Multiple Spaces by Using VBScript
Knowledge Base: Examples of Recursion
Recursion: each item of an expression is generated by repeating a particular definition recursively.
Recursively Removal of Multiple Spaces by Using VBScript
Example of Recursively Removal of Multiple Spaces by Using VBScript.last updated 01Sep2017
ASP VbScript Command:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample Page</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
<script runat="server" language="VBScript">
Dim strs
strs=" a adljl klj lsfdf f sfd dfsfs "
Response.Write "Sample Display: ""&strs&"""&"<br />"
Response.Write "Sample Storage: ""&replace(strs," "," ")&"""&"<br />"
Response.Write "Start Removal of Multiple Spaces<br />"
Call rmvspace(strs)
Response.Write "End of Recursion<br /><br />"
Response.Write "Another Sample Display: ""<rim(strs)&"""&"<br />"
Response.Write "Sample Storage: ""&replace(ltrim(strs)," "," ")&"""&"<br />"
Response.Write "Start Another Removal of Multiple Spaces<br />"
Call rmvspace(ltrim(strs))
Response.Write "End of Recursion<br /><br />"
Response.Write "Another Sample Display: ""&rtrim(strs)&"""&"<br />"
Response.Write "Sample Storage: ""&replace(rtrim(strs)," "," ")&"""&"<br />"
Response.Write "Start Anothe Removal of Multiple Spaces<br />"
Call rmvspace(rtrim(strs))
Response.Write "End of Recursion<br /><br />"
Response.Write "Another Sample Display: ""&trim(strs)&"""&"<br />"
Response.Write "Sample Storage: ""&replace(trim(strs)," "," ")&"""&"<br />"
Response.Write "Start Anothe Removal of Multiple Spaces<br />"
Call rmvspace(trim(strs))
Response.Write "End of Recursion<br /><br />"
Function rmvspace(blk_str)
Dim a,b,c
a= split(blk_str," ",2)
If ubound(a)=1 Then
c=ltrim(a(1))
Select Case c
Case ""," ",null
b= a(0)&" "
Case Else
b= a(0)&" "& rmvspace(c)
End Select
Else
b=a(0)
End IF
rmvspace=b
Response.Write """&b&"""&"<br />"
End Function
</script>
</body>
</html>
HTTP Response Output:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample Page</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
</body>
</html>Sample Display: " a adljl klj lsfdf f sfd dfsfs "<br />Sample Storage: " a adljl klj lsfdf f sfd dfsfs "<br />Start Removal of Multiple Spaces<br />"dfsfs "<br />"sfd dfsfs "<br />"f sfd dfsfs "<br />"lsfdf f sfd dfsfs "<br />"klj lsfdf f sfd dfsfs "<br />"adljl klj lsfdf f sfd dfsfs "<br />"a adljl klj lsfdf f sfd dfsfs "<br />" a adljl klj lsfdf f sfd dfsfs "<br />End of Recursion<br /><br />Another Sample Display: "a adljl klj lsfdf f sfd dfsfs "<br />Sample Storage: "a adljl klj lsfdf f sfd dfsfs "<br />Start Another Removal of Multiple Spaces<br />"dfsfs "<br />"sfd dfsfs "<br />"f sfd dfsfs "<br />"lsfdf f sfd dfsfs "<br />"klj lsfdf f sfd dfsfs "<br />"adljl klj lsfdf f sfd dfsfs "<br />"a adljl klj lsfdf f sfd dfsfs "<br />End of Recursion<br /><br />Another Sample Display: " a adljl klj lsfdf f sfd dfsfs"<br />Sample Storage: " a adljl klj lsfdf f sfd dfsfs"<br />Start Anothe Removal of Multiple Spaces<br />"dfsfs"<br />"sfd dfsfs"<br />"f sfd dfsfs"<br />"lsfdf f sfd dfsfs"<br />"klj lsfdf f sfd dfsfs"<br />"adljl klj lsfdf f sfd dfsfs"<br />"a adljl klj lsfdf f sfd dfsfs"<br />" a adljl klj lsfdf f sfd dfsfs"<br />End of Recursion<br /><br />Another Sample Display: "a adljl klj lsfdf f sfd dfsfs"<br />Sample Storage: "a adljl klj lsfdf f sfd dfsfs"<br />Start Anothe Removal of Multiple Spaces<br />"dfsfs"<br />"sfd dfsfs"<br />"f sfd dfsfs"<br />"lsfdf f sfd dfsfs"<br />"klj lsfdf f sfd dfsfs"<br />"adljl klj lsfdf f sfd dfsfs"<br />"a adljl klj lsfdf f sfd dfsfs"<br />End of Recursion<br /><br />
HTML Web Page Embedded Output:
©sideway
ID: 170800040 Last Updated: 8/31/2017 Revision: 0 Ref:
References
- Active Server Pages, , http://msdn.microsoft.com/en-us/library/aa286483.aspx
- ASP Overview, , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
- ASP Best Practices, , http://technet.microsoft.com/en-us/library/cc939157.aspx
- ASP Built-in Objects, , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
- Response Object, , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
- Request Object, , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
- Server Object (IIS), , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
- Application Object (IIS), , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
- Session Object (IIS), , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
- ASPError Object, , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
- ObjectContext Object (IIS), , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
- Debugging Global.asa Files, , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
- How to: Debug Global.asa files, , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
- Calling COM Components from ASP Pages, , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
- IIS ASP Scripting Reference, , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
- ASP Keywords, , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
- Creating Simple ASP Pages, , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
- Including Files in ASP Applications, , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
- ASP Overview, , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
- FileSystemObject Object, , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
- http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx, , ADO Object Model
- ADO Fundamentals, , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
|
|