如何用其他字符串将某个字符中的子字符串替换为另一个字符?
first = 4
last = 11
replacement = '...'
'show me the money'.replace_part(first, last, replacement)
# => 'show...money'
str = 'show me the money'
first = 4
last = 11
replacement = '...'
str[first..last] = replacement
str
#=> 'show...money'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)