From: Ibraheem Ibz Umaru-Mohammed Date: 2002-10-20T04:48:51+09:00 Subject: Re: string[lastchar] -> string? * Szabolcs Szasz [2002-10-19 20:33]: > How to elegantly get the last char of a string as a string? > Somehow I fear I won't be cacthing girls' attention with this: > > if ('' << str[str.length-1]) = 'x' > str.chop > do_things_with(str) > ... > end > ibz@ignoramus:$ irb Reading config file... done. ruby-1.7.3 on i686-pc-linux with irb 0.9(02/07/03) Type 'help' for more information. >>> str = "This is a string" "This is a string" >>> str[-1].chr "g" >>> Is that what you are looking for? --ibz. --