Windows desktop applications
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.

WindowsSubstringWithSpecifiedLength function

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

Syntax


HRESULT WINAPI WindowsSubstringWithSpecifiedLength(
  _In_  HSTRING string,
  _In_  UINT32  startIndex,
  _In_  UINT32  length,
  _Out_ HSTRING *newString
);

Parameters

string [in]

Type: HSTRING

The original string.

startIndex [in]

Type: UINT32

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

length [in]

Type: UINT32

The number of characters in the substring.

newString [out]

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

The substring was created successfully.

E_INVALIDARG

newString is NULL, or startIndex plus length is greater than MAXUINT32, which is 4,294,967,295; that is, hexadecimal 0xFFFFFFFF.

E_BOUNDS

startIndex is greater than the length of string, or startIndex plus length indicates a position not within string.

E_OUTOFMEMORY

Failed to allocate the new substring.

 

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