Partager via


WindowsSubstringWithSpecifiedLength, fonction (winstring.h)

Récupère une sous-chaîne à partir de la chaîne spécifiée. La sous-chaîne commence à une position de caractère spécifiée et a une longueur spécifiée.

Syntaxe

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

Paramètres

string

Type : [in] HSTRING

Chaîne d’origine.

startIndex

Type : [in] UINT32

Position de caractère de départ de base zéro d’une sous-chaîne dans cette instance.

length

Type : [in] UINT32

Nombre de caractères dans la sous-chaîne.

newString

Type : [out] HSTRING*

Chaîne équivalente à la sous-chaîne qui commence à startIndex dans la chaîne, ou NULL si startIndex est égal à la longueur de la chaîne.

Valeur retournée

Type : HRESULT

Cette fonction peut retourner l’une de ces valeurs.

Code de retour Descriptif
S_OK
La sous-chaîne a été créée avec succès.
E_INVALIDARG
newString est NULL, ou startIndex plus longueur est supérieure à MAXUINT32, soit 4 294 967 295 ; c’est-à-dire hexadécimal 0xFFFFFFFF.
E_BOUNDS
startIndex est supérieur à la longueur de la chaîne, ou startIndex plus length indique une position non comprise dans la chaîne.
E_OUTOFMEMORY
Échec de l’allocation de la nouvelle sous-chaîne.

Remarques

Chaque appel à la fonction WindowsSubstringWithSpecifiedLength doit être mis en correspondance avec un appel correspondant à WindowsDeleteString.

Spécifications

Requirement Valeur
Client minimum requis Windows 8 [applications de bureau | Applications UWP]
Serveur minimal pris en charge Windows Server 2012 [applications de bureau | Applications UWP]
plateforme cible Fenêtres
Header winstring.h
Library mincore.lib

Voir aussi

WindowsDeleteString