SplitString

Package:
Class:
Inheritance:
biz.flashscript.text
public class SplitString
N/A
The SplitString class is a text class and splits strings into numbers and letters, however only the first numbers or letters of a string. Use the constructor SplitString.getInstance().
Public Methods
Method Defined By
SplitString.getInstance()
Creates a new instance of the SplitString class.
SplitString
getString(mst:String):String
Returns the letter part of a string.
SplitString
getNumber(mst:String):Number
Returns the number part of a string.
SplitString
Constructor Detail
SplitString.getInstance()
Intializes a new SplitString instance.
Method Detail

getString ():String  method
public function getString(mst:String):String

This method will return a letter part of a string.

Parameters

  • mst:String ____ Specifies the string to split.

getNumber ():String  method
public function getNumber(mst:String):String

This method will return the number part of a string as numbers.

Parameters

  • mst:String ____ Specifies the string to split.
Examples
Create a new fla file and name it SplitString.fla. Place the fla in the same folder as the biz folder and place a dynamic textfield on the timeline and name it myText. Then create an Actionscript file, name it SplitStrings.as and place this script.
package 
{
	import flash.display.Sprite;
	import biz.flashscript.text.SplitString;
	import flash.text.TextField;

	public class SplitStrings extends Sprite
	{
		public var myText:TextField;
		
		public function SplitStrings ():void
		{
			myText.appendText ("String to split is:      abcde123\n");
			var findString:SplitString = SplitString.getInstance();
			var ms:String = "abcde123";
			myText.appendText ("String:      "+findString.getString(ms)+"\n");
			ms = "abcde123";
			myText.appendText ("Numbers:      "+findString.getNumber(ms));
		}
	}
}