WindowsSubstring function (winstring.h)

Retrieves a substring from the specified string. The substring starts at the specified character position.

Syntax

HRESULT WindowsSubstring(
  HSTRING string,
  UINT32  startIndex,
  HSTRING *newString
);

Parameters

string

Type: [in] HSTRING

The original string.

startIndex

Type: [in] UINT32

The zero-based starting character position of a substring in this instance.

newString

Type: [out] HSTRING*

A string that is equivalent to the substring that begins at startIndex in string, or NULL if startIndex is equal to the length of string.

Return value

Type: HRESULT

This function can return one of these values.

Return code Description
S_OK
The substring was created successfully.
E_INVALIDARG
newString is NULL.
E_BOUNDS
startIndex is greater than the length of string.
E_OUTOFMEMORY
Failed to allocate the new substring.

Remarks

Each call to the WindowsSubstring function must be matched with a corresponding call to WindowsDeleteString.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header winstring.h

See also

WindowsDeleteString