Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Phone API Reference - UI Classes (Widgets) - Input - replace

replace

Description

Replaces a range of text from the input widget with another string.

...

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

Code Block
var input = new Input(0, 0, 100, Text.LINE_HEIGHT);
input.value = 'FooBar';
input.replace(3, 5, 'Foo')
return input.toString();  //returns 'FooFoo'