This shows you the differences between two versions of the page.
fr:explode [2016/01/01 22:44] |
fr:explode [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Explode ===== | ||
+ | |||
+ | ==== Format ==== | ||
+ | stringarrayvariable$ = **explode** ( //string// , // | ||
+ | stringarrayvariable$ = **explode** ( //string// , // | ||
+ | arrayvariable$ = **explode** ( //string// , // | ||
+ | arrayvariable$ = **explode** ( //string// , // | ||
+ | |||
+ | ==== Description ==== | ||
+ | Découpe la chaîne de caractères //string// en plusieurs sous-chaînes, | ||
+ | Il est possible de spécifier un troisième paramètre (à vrai: //true//) pour indiquer que la recherche ne tiens pas compte de la casse. | ||
+ | |||
+ | ==== Exemple ==== | ||
+ | < | ||
+ | # Sépare à chaque espace | ||
+ | a$ = "We all live in a yellow submarine." | ||
+ | print a$ | ||
+ | w$ = explode(a$," | ||
+ | for t = 0 to w$[?]-1 | ||
+ | print " | ||
+ | next t | ||
+ | |||
+ | # Sépare à chaque A ou a | ||
+ | a$ = " | ||
+ | print a$ | ||
+ | w$ = explode(a$," | ||
+ | for t = 0 to w$[?]-1 | ||
+ | print " | ||
+ | next t | ||
+ | |||
+ | # Sépare chaque nombre à chaque virgule | ||
+ | a$=" | ||
+ | print a$ | ||
+ | n = explode(a$,"," | ||
+ | for t = 0 to n[?]-1 | ||
+ | print " | ||
+ | next t | ||
+ | </ | ||
+ | Affichera : | ||
+ | < | ||
+ | We all live in a yellow submarine. | ||
+ | w$[0]=We | ||
+ | w$[1]=all | ||
+ | w$[2]=live | ||
+ | w$[3]=in | ||
+ | w$[4]=a | ||
+ | w$[5]=yellow | ||
+ | w$[6]=submarine. | ||
+ | klj; | ||
+ | w$[0]=klj; | ||
+ | w$[1]=lkj | ||
+ | w$[2]=lkj; | ||
+ | 1, | ||
+ | n[0]=1 | ||
+ | n[1]=2 | ||
+ | n[2]=3 | ||
+ | n[3]=77 | ||
+ | n[4]=0 | ||
+ | n[5]=9.987 | ||
+ | n[6]=6.45 | ||
+ | </ | ||
+ | |||
+ | ==== Disponible depuis la version ==== | ||
+ | 0.9.6.55 | ||