I don't think so...I've never seen one, but what's hard about using String.replace? Aren't the following functionally equivalent?

//perl's chomp
String.replace(/[\r\n]*$/);

//perl's chop
String.replace(/.$/);

I guess if you really care, you could extend the String class to add them?

Guy


On 17/10/2008, at 11:27 AM, john fisher wrote:

I see String.replace using a regex, but is there a more straightforward
way to do this (very) common adjustment?

(perl: "chop" and "chomp" delete the last character from a string in
slightly different ways)

thanks,
John



Reply via email to