MID

Icône du lien vers le conceptVoir également

Renvoie une sous-chaîne d'une chaîne de caractères.

Support WebVue - Oui.

Syntaxe

StrVal = MID(Input, Start [, Num]);

Type de retour : STR

Argument

Définition

Input

Chaîne à manipuler. Type STR.

Start

Position de départ pour la sous-chaîne à retourner (0 si 1er caractère). Tout type numérique.

Num

Nombre de caractères dans la sous-chaîne retournée. Tout type numérique.

Exécution

Copie Num caractères de Input à partir du caractère Start. Si Num est omis ou s'il est supérieur à la partie restante de la chaîne, la chaîne est recopiée jusqu'à sa fin.

Exemple

SUB Main()

DIM strChain1 as Str;

DIM strChain2 as Str;

DIM inti1 as Integer;

DIM inti2 as Integer;

 

inti1 = 7;

inti2 = 5;

strChain1 = "Hello, World!";

strChain2 = MID (strChain1,inti1,inti2); '5 characters from the 7th

Print("Return: ",strChain2);

'Display "Return: World"

END SUB