Expand Minimize

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 codeDescription
S_OK

The string replacement was successful.

E_INVALIDARG

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.

E_OUTOFMEMORY

Failed to allocate the new string.

 

Remarks

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 [desktop apps | Windows Store apps]

Header

Winstring.h

 

 

Community Additions

ADD
Show:
© 2014 Microsoft