Skip to main content
October 15, 2012
Answered

Character count in as3?

  • October 15, 2012
  • 1 reply
  • 2333 views

Hello guys,

I need some help making a program that count vowels.

The user inputs a sentece, then clicks a button and the OutputText.text=The number of vowels

I'm quiet sure where to start the function.

I've tried

trace(string.match(/[a|e|u|i|o]/gi).length);

but the output in this case renders to Flash CS and not to the Flash player or OutputText.text

This topic has been closed for replies.
Correct answer kglad

use:

var n:int = string.match(/[a|e|u|i|o]/gi).length;

OutputText.text=n.toString();

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
October 15, 2012

use:

var n:int = string.match(/[a|e|u|i|o]/gi).length;

OutputText.text=n.toString();

October 16, 2012

This worked!

Once again, thank you kglad!

kglad
Community Expert
Community Expert
October 16, 2012

you're welcome.