StrExpand Function:
Expands a string by inserting spaces between characters and three spaces when it encounters a space.
Description:
The StrExpand function expands a string by inserting spaces between each character and three spaces if it encounters a space in the string. There are two required arguments: string and usenbsp. String is the string to expand. usenbsp is a boolean value (true, false) indicating whether the spaces should be HTML nonbreaking spaces ( ) or plain spaces " ".
Syntax:
string = StrExpand(string, usenbsp)
Example:
<%
Response.Write StrExpand("WHERE IS MY UMBRELLA?", False) '--- retuns: W H E R E I S M Y U M B R E L L A ?
%>
ASP Source Code:
<%
Private Function StrExpand(byVal string, byVal usenbsp) Dim Tmp, i For i = 1 to Len( string ) Select Case CBool( usenbsp ) Case False If Mid( string, i, 1 ) = " " Then Tmp = Tmp & " " Else Tmp = Tmp & Mid( string, i, 1 ) & " " End If Case True If Mid( string, i, 1 ) = " " Then Tmp = Tmp & " " Else Tmp = Tmp & Mid( string, i, 1 ) & " " End If End Select Next StrExpand = Tmp End Function
%>
|