Version: 2017.2
public RangeInt selection ;

描述

Returns the character range of the selected text within the string currently being edited. (Read Only)

For example: if the keyboard is editing a text "abcdef" and the "cde" substring is selected, the return value is a RangeInt with the RangeInt.start value set to 2 and a RangeInt.length value of 3.

如果光标介于两个字符之间并且没有选择文本,则 RangeInt.length 属性为 0。

如果 canGetSelection 为 false,这将始终返回一个空范围(从 0 开始,长度为 0)。