Вопрос о подстроке Flash Lite 1.1 - PullRequest
       38

Вопрос о подстроке Flash Lite 1.1

0 голосов
/ 27 августа 2010

Не могли бы вы сказать мне, почему обе строки выводят a?
trace(substring("asd", 0, 1)); // == "a"
trace(substring("asd", 1, 1)); // == "a"
( this выводит s:
trace(substring("asd", 2, 1)); // == "s")

В Flash Lite 1.x индекс начинается с 1?

1 Ответ

1 голос
/ 27 августа 2010

Выписка из 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.
...