[英]Remove a registered trademark from the end of string in Ruby
I am trying to remove a registered trademark from the end of a string so I can compare the two string's Levenshtein normalized distance and get an accurate number. 我试图从字符串的末尾删除注册商标,以便可以比较两个字符串的Levenshtein归一化距离并获得准确的数字。
Does anyone know an easy way to strip the registered trademark symbol off the end of a string in Ruby? 有谁知道在Ruby中从字符串末尾去除注册商标符号的简便方法?
For example: 例如:
example_name1 = Tylenol®
example_name2 = Tylenoloafjd
If you can do such things: 如果您可以执行以下操作:
And then you can do it just like normal: 然后,您可以像平常一样这样做:
example_name1.chomp!("®")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.