DataFunctions.CleanString

Ee798613.c++_on(en-US,CS.10).gifEe798613.vb_off(en-US,CS.10).gif

Use this method to process a string, based on the default or specified locale. The string processing can include stripping out leading and trailing white spaces, modifying string case, and validating that the length of the string falls within a given range.

Definition

Function CleanString(vtInput As Variant,vtMinLen As Variant,vtMaxLen As Variant,vtStripWhite As Variant,vtStripReturn As Variant,vtCase As Variant,vtLocale As Variant) As Variant

Parameters

vtInput

A Variant that contains the text of the string to process.

vtMinLen

A Variant that contains the minimum length against which the length of the input string will be validated. The default value for this parameter is zero (0).

vtMaxLen

A Variant that contains the maximum length against which the length of the input string will be validated. The default value for this parameter is no limit.

vtStripWhite

A Variant that contains the Boolean value that indicates whether leading and trailing white spaces should be stripped from the input string. The default value is True.

vtStripReturn

A Variant that contains the Boolean value that indicates whether the carriage returns contained anywhere in the input string should be stripped. The default value is True.

vtCase

A Variant that specifies any conversions to the case of the input string. The default value for this parameter is zero (0), which results in no modification to the case of the input string. If this parameter is set to one (1), the input string is converted to uppercase. If this parameter is set to two (2), the input string is converted to lowercase.

vtLocale

A Variant that specifies the locale to use when processing the input string. If this parameter is not specified, the value of the Locale property of the DataFunctions object is used.

Return Values

If this method completes successfully, it returns a string Variant that contains the processed string; otherwise, NULL is returned.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

<HTML>
<HEAD>
</HEAD>
<BODY>
<%
Set MSCSDataFunctions = Server.CreateObject("Commerce.DataFunctions")
myLocale = "1033"
MSCSDataFunctions.Locale = myLocale
Dim Result
Dim strData
strData = " Microsoft Press   "
Result = MSCSDataFunctions.CleanString(strData, 1, 20, True, True, 1)
Response.Write Result
' "MICROSOFT PRESS" will be written to the page
%>
</BODY>
</HTML>

See Also

DataFunctions Object

DataFunctions.Locale

Page.RequestString


All rights reserved.