Ruby on Rails - unless multiple conditions -


I'm trying to select an expression unless the expression is one of two values. string == ('dabc' || 'eabc') end substitute_string ('jjjjjabc') =

  def substitute_string (string) string.gsub ('abc', 'xyz' & Gt; 'Jjjjjxyz' substitute_string ('dabc') = & gt; 'Dabc' substitute_string ('eabc') = & gt; 'Exyz'  

I hope to return substitute_string ('eabc') ('eabc') because I said that unless there is no block, which I crossed two values I'm sorry.

I do not understand why this does not work, and what can I do to make the 'EABBC' return 'EABC'?

('dabc' || 'eabc') is a boolean expression Which evaluates to true and returns 'dabc'.

Use two or more:

string == 'dabc' || | Use string == 'EABBC'

or = ~ (match regex pattern)

string = ~ / / (Dabc | Eabc) /

Since you indicated that you are using rail, you are in ? can also be used like this:

until string.in? ['Dabc', 'eabc']


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -