Phone API Reference - UI Classes (Widgets) - Input - replace
replace
Description
Replaces a range of text from the input widget with another string.
Basic Example:Â
 textObj.replace(begin, end, replacement);
Note, this will focus the cursor at the end of the replacement.
Parameters
Name | Required | Type | Default | Description |
---|---|---|---|---|
begin | Yes | integer | Â | Index to begin replacing. |
end | Yes | integer | Â | Index to end replacing. |
replacement | Yes | string | Â | The string to use as the replacement. |
Examples
replace bar with foo
var input = new Input(0, 0, 100, Text.LINE_HEIGHT);
input.value = 'FooBar';
input.replace(3, 5, 'Foo')
return input.toString();Â //returns 'FooFoo' |
Â
Â