actionscript-3 - 从字符串创建一个单词数组(字符串)

标签 actionscript-3 actionscript

如何从一个字符串创建一个字符串数组,例如。

"hello world"将返回 ["hello", "world"]。这需要考虑标点符号等。

可能有一个很好的 RegEx 解决方案,我只是找不到它。

最佳答案

AS3的String.split怎么样?

var text:String = "hello world";
var split:Array = text.split(" "); // this will give you ["hello", "world"]
// then iterate and strip out any redundant punctuation like commas, colons and full stops

关于actionscript-3 - 从字符串创建一个单词数组(字符串),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3118118/

相关文章:

actionscript-3 - AS3 Softbody 纹理八哥

android - 如何为 iOS 和 Android 创建多轨播放器(如 DJ 混音器)?

actionscript-3 - ActionScript 3 中的数组拼接问题

apache-flex - AS3大型游戏性能随时间下降

actionscript-3 - bitmapdata.draw 无提示地失败

javascript - 确保 Flash 对象的背景与页面匹配的好方法是什么?

actionscript-3 - 将 MX 库包含到 Flash CS5 项目中

actionscript-3 - 在 AS3 中将 alpha 百分比转换为 RGBA 十六进制?

actionscript-3 - 使用 as3 解压缩并保存文件?

json - Actionscript 3 Json?