User Tools

Site Tools


en:explode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:explode [2016/08/12 21:44]
admin
en:explode [2020/02/28 10:46]
Line 1: Line 1:
-===== Explode (Function) ===== 
  
-==== Format ==== 
-variable = **explode** ( [[stringexpressions|string_expression]] , [[stringexpressions|delimiter_expression]] )\\ 
-variable = **explode** ( [[stringexpressions|string_expression]] , [[stringexpressions|delimiter_expression]] , [[booleanexpressions|boolean_expression]] )\\ 
- 
-returns a [[lists|list]] of strings.  Typically this function is used to create an array. 
- 
-==== Description ==== 
-Splits up the [[stringexpressions|string_expression]] into substrings wherever the [[stringexpressions|delimiter_expression]] occurs. 
- 
-You may also specify an optional Boolean value to specify that the search will treat upper and lower case letters the same. 
- 
- 
-==== Example ==== 
-<code> 
-# explode on spaces 
-a$ = "We all live in a yellow submarine." 
-print a$ 
-w$ = explode(a$," ") 
-for t = 0 to w$[?]-1 
-   print "w$["+t+"]=" + w$[t] 
-next t 
- 
-# explode on A or a 
-a$ = "klj;lkjalkjAlkj;" 
-print a$ 
-w$ = explode(a$,"A",true) 
-for t = 0 to w$[?]-1 
-   print "w$["+t+"]=" + w$[t] 
-next t 
- 
-# explode numbers on comma 
-a$="1,2,3,77,foo,9.987,6.45" 
-print a$ 
-n = explode(a$,",") 
-for t = 0 to n[?]-1 
-   print "n["+t+"]=" + n[t] 
-next t 
-</code> 
-will display 
-<code> 
-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;lkjalkjAlkj; 
-w$[0]=klj;lkj 
-w$[1]=lkj 
-w$[2]=lkj; 
-1,2,3,77,foo,9.987,6.45 
-n[0]=1 
-n[1]=2 
-n[2]=3 
-n[3]=77 
-n[4]=foo 
-n[5]=9.987 
-n[6]=6.45 
-</code> 
- 
-==== See Also ==== 
-{{page>en:start#String Handling&noheader}} 
- 
-==== History ====  
-|0.9.6.55|New to Version| 
-|1.99.99.55|now allow explode to be used anywhere a list may be used| 
en/explode.txt ยท Last modified: 2020/02/28 10:46 (external edit)