See also: stripCharacters |
Removes all occurrences of a second character string from the first character string.
JSV_stripString(expS1, expS2)
expS1.stripString(expS2)
The stripString function returns the string expS1 with all occurrences of the character string expS2 removed from it. If the character string expS2 does not exist in expS1, then the character string expS1 is returned. If either or both arguments are empty, then null is returned.
The stripString function uses the following arguments.
Argument | Description |
expS1 | String being stripped. |
expS2 | String that is stripped from expS1. |
Unlike stripCharacters, stripString removes the designated string from the target string.
The following lines of code
var testString1 = "Quiet feet make little noise on sleek ice", testString2 = "ee";
document.write( "Removing " + testString2.bold() +
" from " +
testString1.bold() +
" results in " +
JSV_stripString(testString1,testString2).bold() );
testString2 = "le";
document.write( "Removing " + testString2.bold() +
" from " +
testString1.bold() +
" results in " +
JSV_stripString(testString1,testString2).bold() );
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.