SPECIFYING THE NUMBER OF IDENTICAL CHARACTERS WHEN SEARCHING A STRING
Hey everyone,
The built-in function indexOf() searches for a character "." in the string "1.2.3." if the value == 1.
It searches nothing if the value == 0 or 2 or any number greater than 2.
var txt:String = "1.2.3.";
var output:String = String(this);
if (txt.indexOf(".") == 1)
{
trace(output); //[object MainTimeline]
}
The must be a simple method for specifying the number of characters "." when searching the string "1.2.3.".
For example if there is 2 characters "." in the string "1.2.", then run through a statement but if it does not contain 2 characters "." then do nothing.
There is a built-in function called contains but it is mainly used in XML.
indexOf() looks like unstable javascript codes, one of those framework that unixers hate.
