Is it possible to detect the last character of string in ruby on rails and replace it by "". Explanation :: Suppose I have string as "demo-" then i have to check its last character, If it is "-" then replace it by "", otherwise no action should be taken.
Example - Code ::
search_text.downcase! if !search_text.nil?
now if seach_text have value as "demo-" then change it to "demo" by replacing "-".
Thanks in Advance !!!