The CleanString method processes a string, based on the specified locale. This string processing can include stripping out leading and trailing white spaces, modifying the case of the string, and validating that the length of the string falls within a given range. If successful, CleanString returns the processed string; otherwise, Null.
DataFunctions.CleanString(String, MinLength, MaxLength, StripWhiteSpaces, StripReturn, Case, Locale)
The following represents a sample call to CleanString:
Set MSCSDataFunctions = Server.CreateObject("Commerce.DataFunctions")
MSCSDataFunctions.Locale = &H0409
Dim Result
Dim strData
strData = " Microsoft Press "
Result = MSCSDataFunctions.CleanString(strData, 1, 20, True, True, 1)
Response.Write chr(34) & Result & chr(34)
The values passed to CleanString in this example indicate that the value in strData
should be range-tested to ensure that it is at least one character and no more than 20 characters, that any leading or trailing white spaces should be removed, that any carriage returns in the string should be removed, and that the string should be converted to uppercase. Because the Locale parameter is not specified in the call to CleanString, the method defaults to the value specified in the DataFunctions object's Locale property.
The preceding example produces the following text:
"MICROSOFT PRESS"