SecureString.replaceString(options)

Note:

The content in this help topic pertains to SuiteScript 2.0 and SuiteScript 2.1.

Method Description

Replaces all occurrences of a pattern string inside an https.SecureString with a replacement string.

Tip:

If you are using an https.SecureString as a URL in https.put(options) or https.post(options) calls, you can use this method to escape any special characters you are using in the URL. For instance, you can replace the ‘#’ special character with ‘%23’ to allow for the use of ‘#’ in a SecureString used as a URL.

Returns

A converted https.SecureString (not a new SecureString).

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/https Module

Since

2021.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.pattern

string

required

The string to be replaced.

options.replacement

string

required

The replacement string.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/https Module Script Samples.

          // Add additional code 
...
var secureString1 = https.createSecureString({
    input: "myFirstSecureString"
});

var originalString = "First";
var newString = "Only"

secureString1.replaceString({
    pattern: originalString
    replacement: newString
}); 
...
// Add additional code 

        

Related Topics

https.SecureString
N/https Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices