From: Austin Ziegler Date: 2006-06-27T02:03:28+09:00 Subject: Re: Unicode roadmap? On 6/26/06, Logan Capaldo wrote: > On Jun 26, 2006, at 2:13 AM, Joel VanderWerf wrote: > > irb(main):001:0> "It's needlessly cryptic."[/./] > > => "I" > > Not disagreeing, just trying to get more credit for regexes. > > irb(main):010:0> "It's needlessly cryptic."[/.{17}(.)/, 1] > > => "r" > > That's a bit more cryptic. > It's funny I'm always forgetting you can index by regexp. But this > brings up a good point, this is Ruby, with the new Hash / named > argument syntax we can do: > > "It's needlessly cryptic."[byte:2] > > This doesn't add anything at all to the conversation, but I think it > looks good, and it's in the "make similiar things look similar" vein. > > Indexing Strings > > s[0] # The first character > s[/./] # The first character > s[byte:0] # The first byte (of a string with some non ascii > compatible encoding) I kinda like that. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca