See also: stripString

Removes occurrences of all the characters in a second character string from the first character string.

Syntax

JSV_stripCharacters(expS1, expS2)

Prototype

expS1.stripCharacters(expS2)

Returns

The stripCharacters function returns the string expS1 with all occurrences of each character in expS2 removed. If any character in expS2 does not exist in expS1, then the character string expS1 is returned. If either or both arguments are empty, then null is returned.

Parameters

The stripCharacters function uses the following arguments.

Argument Description
expS1 String being stripped.
expS2 String containing the characters to be stripped from expS1.

Remarks

Unlike stripString, stripCharacters removes each character in the designated string from the target string.

Dependencies

JSV_isEmpty

Example

The following lines of code

var testString1 = "Quiet feet make little noise on sleek ice", testString2 = "e";
document.write( "Removing " + testString2.bold() + 
    " from " +
    testString1.bold() +
    " results in " +
    JSV_stripCharacters(testString1,testString2).bold() );
testString2 = "e";
document.write( "Removing " + testString2.bold() + 
    " from " +
    testString1.bold() +
    " results in " +
    JSV_stripCharacters(testString1,testString2).bold() );

produce