MCPcopy Create free account
hub / github.com/cryptii/cryptii / replaceWhitespaces

Method replaceWhitespaces

src/StringUtil.js:85–89  ·  view source on GitHub ↗

* Replaces Unicode whitespace characters with given character. * @param {string} string Haystack * @param {string} replacement Replacement string * @param {Boolean} [reduceToSingle=false] Wether to replace * multiple successive space characters with a single one * @return {string}

(string, replacement, reduceToSingle = false)

Source from the content-addressed store, hash-verified

83 * @return {string}
84 */
85 static replaceWhitespaces (string, replacement, reduceToSingle = false) {
86 return reduceToSingle
87 ? string.replace(/\s+/g, replacement)
88 : string.replace(/\s/g, replacement)
89 }
90}

Callers 2

removeWhitespacesMethod · 0.95
normalizeWhitespacesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected