Toggle menu

filterSwearWords(text[, filterString])

Description

This method replaces any words in a supplied string that match an entry in iCM's Swear Word Dictionary. By default they are replaced with a series of asterisks.

Parameters

NameTypeDescription
textString, requiredThe text to perform the replacement on
filterStringString, optionalThe string that will be used in any substitutions

Returns

PropertyTypeDescription
dataStringThe text with substituted words

Example

In this example the word "pumpkin" has been added to iCM's swear word dictionary, so is replaced by the supplied filter string.

Request

function(params, credentials) {
    let resp = this.callWorkerMethod('formutils', 'filterswearwords', {
        'text': 'words pumpkin words words words',
        'filterString': 'REDACTED'
    });
    return resp;
}

Response

{
    "id": 12,
    "result": {
        "data": "words REDACTED words words words",
        "success": true
    },
    "jsonrpc": "2.0"
}

Last modified on 1 August 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon