Skip to main content

.corrupt()

Applies corruption throughout a given string, in the specified frequency.

Syntax

#fs.scripts.lib().corrupt(str, corruption);

Parameters

str

The string to be corrupted.

corruption

An integer specifying the "level" of corruption. The actual frequency of corruption (in corrupted characters per 80 characters of input) is given by using this integer as an index into [[.corruptions]]. Invalid indexes result in no corruption.

Return

Returns a string.

Example

function(context, args) {
const l = #fs.scripts.lib();
const my_string = "I am a string to be corrupted.";

return l.corrupt(my_string, 3);
}