Ruby string include? percent sign include? '%' (Rubymine debugger) -
this due in watches section of rubymine debugger. irb works fine
i'm mystified. cannot figure out how see if ruby string includes %
sign.
i've tried:
text = "foo %{bar}" text.include? '%' text.include? '\%' text.include? '%%'
...as double quotes. i've tried regex equivalents. i'm sure incredibly simple isn't found through search due normal use of symbol.
not problem has been identified ide. vote close. thank you
i don't see problem when using include? '%'
:
text = "foo %{bar}" text.include? '%' # => true text.include? '\%' # => false text.include? '%%' # => false
you can use string []
shortcuts:
text['%'] # => "%" !!text['%'] # => true
Comments
Post a Comment