BY SPECIFYING THE NUMBER OF IDENTICAL CHARACTERS WHEN SEARCHING FOR A STRING

Hey everybody,

built-in indexOf() finds a character "." in the string "1.2.3." If value == 1.

It looks nothing if the value == 0 or 2 or a 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 to specify the number of characters "." When you search for the string "1.2.3.".

For example, if there are 2 characters "." in the string "1.2.", then run it through a statement but if contains no 2 characters "." then do nothing.

There is a built-in function called contains , but it is mainly used in XML.

indexOf() resembles codes javascript unstable, one of these framework which unixers hatred.

You don't have to use regular expressions to determine how many points is in the string. Use of split and read the length:

var txt:String = '1.2.3.';

trace (txt. Split("."). (length);

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • Nothing new sound card

    I just installed a map his (DX PCI Express 7.1, driver version 6.12.8.1730, which says that my system is up to date) and now have no sound. I suspect a lack of connecting the power supply, even if I plugged in the power connector (the indicator light

  • How can I turn off Genius in iTunes 12.3.2?

    How can I turn off Genius in iTunes 12.3.2. El Capitan late 2008 Macbook OS version

  • HP PHOTOSMART C6380: UPLOAD THE PHOTO

    WHEN I TRY TO UPLOAD THE PHOTO ON MY HP PHOTOSMART C6380 IT ME SAID THAT THE COMPONENT I AM TRYING TO USE IS ON A CD ROM THAT IS NOT AVAILABLE. INSERT THE 'HP PhotosmartEssential' diskand, click OK. I WAS UPLOADING PHOTO FOR YEARS AND HAVE NOT RECEIV

  • How to fix my forgotten pass on tab 7

    Please help to fix the password on one of my slate children 7? Thank you.

  • HP 3115 m: Bluetooth + network controller driver

    I've had my laptop recently restored, and everything is perfect in addition to one thing. Now, nothing will connect via Wi - Fi. And whenever I try to install a Wi - Fi driver, it says that my Bluetooth is disabled. So when I try to install bluetooth