Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ruby incorrect method behaviour (possible depending charset)
- irb(main):002:0> pp " LS 600"
- "302240302240302240302240LS 600"
- irb(main):003:0> pp " LS 600".strip
- "302240302240302240302240LS 600"
- # Ruby 1.9.2 only.
- # Remove any whitespace-like characters from beginning/end.
- "302240302240LS 600".gsub(/^p{Space}+|p{Space}+$/, "")
- # Ruby 1.8.7/1.9.2.
- $KCODE = "u"
- require "rubygems"
- require "active_support/core_ext/string/multibyte"
- # Remove any whitespace-like characters from beginning/end.
- "302240302240LS 600".mb_chars.strip.to_s
Advertisement
Add Comment
Please, Sign In to add comment