Flash Lite 1.1子串问题

时间:2010-08-26 21:31:45

标签: flash string flashlite

你能告诉我为什么两行打印出a吗? trace(substring("asd", 0, 1)); // == "a"
trace(substring("asd", 1, 1)); // == "a"
打印出s
trace(substring("asd", 2, 1)); // == "s"

在Flash Lite 1.x中,索引是否以1开始?

1 个答案:

答案 0 :(得分:1)

摘录自 http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary701.html

Availability
Flash Player 4. This function has been deprecated in favor of String.substr .

Description
String function; extracts part of a string. This function is 1-based, 
whereas the String object methods are 0-based.