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' |