How I can delete the first "#" character of a string?
"fooo#oooooo#bar"
"fooooooooo#bar"
"fooo#oooooo#bar".delete_first("#") // Exist some method like this?
To delete the first character from a string, you can use either the REPLACE function or a combination of RIGHT and LEN functions. Here, we simply take 1 character from the first position and replace it with an empty string ("").
The formula =RIGHT(A2,LEN(A2)-4) in cell B2 is used to remove the first four characters in the product code.
sub (not gsub
) does that:
"fooo#oooooo#bar".sub('#', '') #=> "fooooooooo#bar"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With