Created
September 23, 2021 04:55
-
-
Save ndeto/6f9b4b2b8637dda8e10a1e592c4547ce to your computer and use it in GitHub Desktop.
Clean Backslashes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean backslash characters | |
def clean_str(str) | |
new_str = [] | |
str.chars.each do |char| | |
if char == "\\" | |
next | |
end | |
new_str << char | |
end | |
new_str.join("") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment