Share via


IDataFunctions_4_0::CleanString Method [C++]

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

[C++]

HRESULT IDataFunctions_4_0::CleanString(VARIANTvtInput,
 VARIANTvtMinLen,
 VARIANTvtMaxLen,
 VARIANTvtStripWhite,
 VARIANTvtStripReturn,
 VARIANTvtCase,
 VARIANTvtLocale,
 VARIANT*pvarOutput);

[Visual Basic]

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[C++]
    [in] A VARIANT that contains the text of the string to process.
  • vtInput[Visual Basic]
    A Variant that contains the text of the string to process.
  • vtMinLen[C++]
    [in] 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).
  • vtMinLen[Visual Basic]
    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[C++]
    [in] 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.
  • vtMaxLen[Visual Basic]
    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[C++]
    [in] A VARIANT that contains a Boolean value that indicates whether leading and trailing white spaces should be stripped from the input string. The default value is TRUE.
  • vtStripWhite[Visual Basic]
    A Variant that contains a Boolean value that indicates whether leading and trailing white spaces should be stripped from the input string. The default value is True.
  • vtStripReturn[C++]
    [in] A VARIANT that contains a Boolean value that indicates whether the carriage returns contained anywhere in the input string should be stripped. The default value is TRUE.
  • vtStripReturn[Visual Basic]
    A Variant that contains a Boolean value that indicates whether the carriage returns contained anywhere in the input string should be stripped. The default value is True.
  • vtCase[C++]
    [in] 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.
  • vtCase[Visual Basic]
    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[C++]
    [in] 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.
  • vtLocale[Visual Basic]
    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.
  • pvarOutput[C++]
    [out, retval] A pointer used to return a VARIANT that contains the processed string.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

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

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT 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, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] 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

[C++] The pvarOutput parameter contains valid data only if the method completes successfully.

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

[Visual Basic]

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

[C++]DataFunctions Object

[C++]IDataFunctions_4_0::get_Locale, put_Locale

[C++]IMSCSPage_3_0::RequestString

[Visual Basic]DataFunctions Object

[Visual Basic]DataFunctions.Locale

[Visual Basic]Page.RequestString

Copyright © 2005 Microsoft Corporation.
All rights reserved.