DS Server

Javascript: TextCharCollection.remove Method

Method|Introduced in 28.0

Description

Removes the character by number.

Syntax

<void> TextCharCollection.remove(<number> number, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
number

Specifies which character to remove by the textchar's number. The first character has the number 1.

callback

Optional. Receives whether the textchar is succesfully removed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TextCharCollection.remove in a practical document-editing workflow. It removes the character by number.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function remove(textChars) {
    textChars.remove(
        1,
        function(result) {
            if (result) {
                console.log("remove is available.");
            } else {
                console.warn("remove is not available in the current document state.");
            }
        },
        onTxError
    );
}