bit/utils/string/clean-char

cleans the first occurence of char from str reference.

0 Likes
Use in your codeLearn more
bit import bit.utils/string/clean-char

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