![]() |
Show Changes |
![]() |
|
![]() |
Recent Changes |
![]() |
Subscriptions |
![]() |
Lost and Found |
![]() |
Find References |
![]() |
Rename |
![]() |
Administration Page |
![]() |
Topic Locks |
Search |
History
10/4/2007 8:06:21 PM |
-82.148.98.34 |
9/11/2007 12:59:49 PM |
-202.156.13.2 |
5/30/2007 12:26:44 PM |
-125.72.28.38 |
5/28/2007 6:16:46 AM |
-69.136.148.27 |
5/4/2006 2:42:50 AM |
-218.164.11.228 |
![]() |
List all versions |
accepts a single character as separator.
returns tokens as an array of strings.
function tokenize(str,sep) { local start = 0; local idx; local charsep = sep.tochar(); local ret = [] while(idx = str.find(charsep,start)) { ret.append(str.slice(start,idx)); start = idx+1; } if(start != str.len()) { ret.append(str.slice(start,str.len())); } return ret; } local str = "1,2,3,123123,12312,2"; foreach( i,val in tokenize(str,',')) { ::print(val + "\n"); }
accepts a string with multiple valid separators.
returns tokens as an array of strings.
function rex_tokenize(str,seps) { local exp = "[" //escapes separators foreach(char in seps) { exp += @"\"; exp += char.tochar(); } exp += "]"; // local rex = regexp(exp); local start = 0; local idx; local ret = [] while(idx = rex.search(str,start)) { ret.append(str.slice(start,idx.begin)); start = idx.begin+1; } if(start != str.len()) { ret.append(str.slice(start,str.len())); } return ret; } local str = "1,2,3,123123;12312."; foreach( i,val in rex_tokenize(str,",;.")) { ::print(val + "\n"); }