root / trunk / web / dojo / dojox / string / tokenize.js
History | View | Annotate | Download (780 Bytes)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.string.tokenize"]){ |
||
9 | dojo._hasResource["dojox.string.tokenize"]=true; |
||
10 | dojo.provide("dojox.string.tokenize");
|
||
11 | dojox.string.tokenize=function(_1,re,_2,_3){ |
||
12 | var _4=[];
|
||
13 | var _5,_6,_7=0; |
||
14 | while(_5=re.exec(_1)){
|
||
15 | _6=_1.slice(_7,re.lastIndex-_5[0].length);
|
||
16 | if(_6.length){
|
||
17 | _4.push(_6); |
||
18 | } |
||
19 | if(_2){
|
||
20 | if(dojo.isOpera){
|
||
21 | var _8=_5.slice(0); |
||
22 | while(_8.length<_5.length){
|
||
23 | _8.push(null);
|
||
24 | } |
||
25 | _5=_8; |
||
26 | } |
||
27 | var _9=_2.apply(_3,_5.slice(1).concat(_4.length)); |
||
28 | if(typeof _9!="undefined"){ |
||
29 | _4.push(_9); |
||
30 | } |
||
31 | } |
||
32 | _7=re.lastIndex; |
||
33 | } |
||
34 | _6=_1.slice(_7); |
||
35 | if(_6.length){
|
||
36 | _4.push(_6); |
||
37 | } |
||
38 | return _4;
|
||
39 | }; |
||
40 | } |