Module: util/string

Helper function(s) for strings.

Source:

Methods

(static) substrForceMemCopy(s, start, lengthopt) → {string}

Parameters:
Name Type Attributes Default Description
s string

A string

start number

A non-negative integer start position

length number <optional>
s.length-start

A non-negative length. If omitted, it is calculated as s.length - start

JS RUNTIME OPTIMIZATION PREVENTION HACK

Workaround for https://bugs.chromium.org/p/v8/issues/detail?id=2869

This is the same as the standard string function substr, but it forces the JS runtime to allocate new memory.

Modern runtimes internally don't always allocate new memory, instead they keep a reference to the original string as well as start and end within that string if the runtime sees a read-only use of the sub string.

Source:
Returns:

Type: string