Sunday, September 27, 2009

upcase!

  • When I use upcase! for array in regexp,I got error.

  • ex.)

    str = 'ID5'
    str.ucase # -> ID5
    str.upcase! # -> nil

  • When I use option -i(ignore case) for array in regexp,I got error.

  • ex.)

    str = 'AaA'
    /^#{str}$/ =~ 'AAA' # -> nil
    /^#{str}$/i =~ 'AAA' # -> nil (This is strange)
    /^#{str.upcase!}$/ =~ 'AAA' # -> nil (This is also strange)
    /^#{str.upcase}$/ =~ 'AAA' # -> 0

    No comments:

    Post a Comment