Share your code. Components are building blocks, you are the architect.

string/clean-char
v1.0.0
1.0.0
0.0.1
Contributors
Gravatar for undefined
bit
0
MIT
PUBLIC
1
0     DEPENDENCIES
Build: pass
BuildPass
Build Status: pass

cleans the first occurence of char from str reference.

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set @bit:registry https://node.bitsrc.io
Use string/clean-char in your project
npm i @bit/bit.utils.string.clean-char
Copied

cleanChar (str:string, char:string) : string

cleans the first occurence of char from str reference.

Example

cleanChar('hello', 'h') // => 'ello'

Arguments

str: string

string to perform cleaning on.

char: string

character to clean from string

Returns

string

cleaned string.

Test Summary


#cleanChar() should clean first char `h` from string `hello`Pass
#cleanChar() should return string `foo` without any change as char `z` is not containedPass
#cleanChar() should never mutate given string referencePass