刪除「\」是新來ruby.I有像我如何從字符串
string = "You have successfully placed Service Request No. \#{@service_requests.id} for \#{@service_requests.category.name} . Our representative will be in touch with you soon for the same. Thank you."
一個字符串,我想從整個字符串中刪除「\」。
output_string = "You have successfully placed Service Request No. #{@service_requests.id} for #{@service_requests.category.name} . Our representative will be in touch with you soon for the same. Thank you."
如何使它成爲可能。
對於「_how從string_中刪除反斜槓」這個問題,你給了一個正確的答案,並且你在它下面評論爲「它不工作」。這意味着,你說錯了問題。請詳細描述你有什麼,你需要做什麼,你正在屈服什麼以及有什麼問題。與此同時downvoted。 – mudasobwa
其實我想從字符串中刪除反斜線。下面的一些建議不適合我。但@Зелёный答案正常工作,所以我upvoted – vicky
'「\#」'不是一個反斜槓後面跟一個英鎊符號。相反,它是一個單個字符,一個轉義的'「#」',它與一個非轉義的'「#」'相同:''\#「。size#=> 1; 「\#」==「#」#=> true'。 –