Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

clean-char

v1.0.0arrow_drop_down
v1.0.0
STATUS
Passing
DOWNLOADS
1
VISIBILITY
Public
PUBLISHED
4 months ago
SIZE
480 B
cleans the first occurence of `char` from `str` reference.
1 contributor
Use clean-char in your project ?
Copied
npm i @bit/skow0020.my-components.clean-char
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
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
cleanChar('hello', 'h') // => 'ello'
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