clean-char

v1.0.0arrow_drop_down
v1.0.0
v0.0.1
STATUS
Passing
DOWNLOADS
26
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
7 years ago
SIZE
485 B
cleans the first occurence of `char` from `str` reference.
2 contributors
Install clean-char as a package?
Copied
npm i @bit/bit.utils.string.clean-char
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
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 contained

Pass

#cleanChar() should never mutate given string reference

Pass
Help and resources