Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

 

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

Winstring.h

 

 

Show:
© 2016 Microsoft