From: djberg96@... (Daniel Berger) Date: 2004-10-25T07:29:10+09:00 Subject: Re: [rcr] String#first / String#last Simon Strandgaard wrote in message news:<200410241718.48182.neoneye@adslhome.dk>... > problem: > I often use a range to extract the beginning/ending letters.. > like this "string"[-4, 4] #-> "ring" > It feels somewhat redundant that I have to type the length 2 times. > A very simple operation that easily can confuse people if they > are browsing through others code.. this is a place where one easily can > introduce off-by-one errors. > > > motivation: > When looking at the Array class I see that it has #first and #last > methods.. just for this purpose, to extract the sub-array either > from the beginning or the ending. > Why not also use #first and #last on String ? Why not just turn String into an Array of characters? It feels like that's how everyone wants a String to behave anyway. Dan