Michael Hayes <mike / aiinc.ca> schrieb:
> I'm sure it's possible to do it with sub or gsub,
> I could probably write it myself after a few tries.

You can use: string.sub(/\r?\n\z/, '')

-- 
The man who has fed the chicken every day throughout its life at last wrings 
its neck instead, showing that more refined views as to the uniformity of 
nature would have been useful to the chicken.
  -- Bertand Russell, "The Problems of Philosophy", 1912