Closed emyatsuna closed 3 years ago
Why not:
>> 'This /is a /test. Need to /replace or /delete the /slashes only in this /string.'.tr('/', '')
=> "This is a test. Need to replace or delete the slashes only in this string."
thanks @kotp ! That worked. My pipeline is not complaining about syntax errors via rubocop and the code still works.
You are welcome. Don't forget that you can always, even selectively, change Rubocop's opinion. See my answer on stack overflow to see some examples.
Hi,
I need to cleanup my pipeline rubocop syntax error. It is complaining with the replacement of empty of blank in my string. The
.gsub
function works when tested but rubocop is not accepting it and my syntax in pipeline failed. I've checked and I can only use the.delete_prefix
and.delete_suffix
functions. Is there a way to use the delete funtcion as deleting all characters '/
' inside themystr
?sample string:
This /is a /test. Need to /replace or /delete the /slashes only in this /string.
Thank you.