|
||
|
ASP Functions Trim() function example Essential syntax: LTrim() RTrim() Trim() Here is an example of trimming both leading and trailing spaces from a character string stored in a variable:
<HTML>
<% 'BEGIN ASP SCRIPT
Dim cTest, cNew 'Initialize a couple of
'character variables
cTest = "this is a test"
cNew = Trim(cTest)
%>
<!–END ASP SCRIPT ––>
The new value is <%=cNew%>.
</HTML>
The output from this code segment would be: The new value is this is a test.
This function could be useful in joining data from multiple fields (first name in one field, last name in another) or a
text field in an HTML FORM in which the user may have put in a blank line or spaces before or after the actual
text.
|
||
|
|
||
