WindowsReplaceString function
Replaces all occurrences of a set of characters in the specified string with another set of characters to create a new string.
Syntax
HRESULT WINAPI WindowsReplaceString( _In_ HSTRING string, _In_ HSTRING stringReplaced, _In_ HSTRING stringReplaceWith, _Out_ HSTRING *newString );
Parameters
- string [in]
-
Type: HSTRING
The original string.
- stringReplaced [in]
-
Type: HSTRING
The string to be replaced.
- stringReplaceWith [in]
-
Type: HSTRING
The string to replace all occurrences of stringReplaced. If this parameter is NULL, all instances of stringReplaced are removed.
- newString [out]
-
Type: HSTRING*
A string that is equivalent to the original, except that all instances of stringReplaced are replaced with stringReplaceWith.
Return value
Type: HRESULT
This function can return one of these values.
| Return code | Description |
|---|---|
|
The string replacement was successful. |
|
newString is NULL, stringReplaced is empty, or the length of string1 plus the length of string2 is greater than MAXUINT32, which is 4,294,967,295; that is, hexadecimal 0xFFFFFFFF. |
|
Failed to allocate the new string. |
Remarks
Each call to the WindowsReplaceString function must be matched with a corresponding call to WindowsDeleteString.
Requirements
|
Minimum supported client |
Windows 8 [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2012 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8 |
|
Header |
|
See also