Word Split Test
♥0 |
Line 27 |
Modified 2010-10-07 08:21:19 |
MIT License
archived:2017-03-20 19:26:13
ActionScript3 source code
/**
* Copyright rfkrocktk ( http://wonderfl.net/user/rfkrocktk )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/oQHp
*/
package {
import flash.text.TextField;
import flash.text.TextFormat;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
var textfield:TextField = new TextField();
textfield.width = stage.stageWidth;
textfield.height = stage.stageHeight;
textfield.defaultTextFormat = new TextFormat("Courier New");
var originalString:String = "yyyy-MM-dd HH:mm:ss,SSS";
var regex:RegExp = new RegExp("(\\W+|\\w+)");
var result:Array = originalString.split(regex);
textfield.text = "Original String: " + originalString + "\n";
textfield.appendText("Regular Expression: " + regex.source + "\n");
textfield.appendText("Result: [" + result.toString() + "]");
for (var i:uint = 0; i < result.length; i++) {
textfield.appendText("Result[" + i + "]: " + result[i] + "\n");
}
this.addChild(textfield);
}
}
}