Peña, Botp
6/28/2008 4:00:00 AM
From: Xuan [mailto:xuanpa@gmail.com]=20
# Instead of c.chomp! as it was suggested, use c=3Dc.chomp(" ") before =
the
that is dangerous since chomp(" ") only chomps the ending space, but not =
line endings like newline.
c=3D"asdf \n".chomp(" ")
#=3D> "asdf \n"
in his case, i would prefer #strip wc will strip out all whitespace =
before and after the string
like,
c=3D" asdf \t \r\n"
#=3D> " asdf \t \r\n"
c.strip!
#=3D> "asdf"
# "if"statement. The problem seems to be a white space at the end of
# "c".. if you use print instead of puts you'll see it.
using p is better/catching to the eye
print "asdf "
asdf #=3D> nil
p "asdf "
"asdf "
#=3D> nil
# About your second problem I just tested it and works fine for me.
# Maybe txt file encoding is wrong...be sure to save it with utf-8 enc.
i agree.
kind regards -botp