How to convert a string to lower or upper case in Ruby

后端 未结 11 968
梦如初夏
梦如初夏 2020-12-07 07:00

How do I take a string and convert it to lower or upper case in Ruby?

11条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 07:21

    Won't work for every, but this just saved me a bunch of time. I just had the problem with a CSV returning "TRUE or "FALSE" so I just added VALUE.to_s.downcase == "true" which will return the boolean true if the value is "TRUE" and false if the value is "FALSE", but will still work for the boolean true and false.

提交回复
热议问题