vts*_*vts 0 regex flash actionscript-3
如何使用flash as3计算字符串中的大写字母数?
例如
var thestring = "This is The String";
Run Code Online (Sandbox Code Playgroud)
应该返回int 3
谢谢
Mar*_*rty 11
// Starting string.
var thestring:String = "This is The String";
// Match all capital letters and check the length of the returned match array.
var caps:int = thestring.match(/[A-Z]/g).length;
trace(caps); // 3
Run Code Online (Sandbox Code Playgroud)