Kein-Hong Man a écrit :
Philippe Lhoste wrote:
I have no time to look into it right now, but I give a little
improvement of your trimR function: see this little code sample:
testString = "Foo Bar\r\n"
finalString = string.gsub(testString, "^([^%c]*)%c*", "%1")
print(">" .. testString .. "<")
print(">" .. finalString .. "<")
This looks better, and the intention of the code is clear:
finalString = string.gsub(testString, "[\r\n]+$", "")
I'll add the following to the UsingLuaWithScite wiki entry under the
editor:GetLine(n) bit:
function Chomp(line)
return string.gsub(line, "[\r\n]+$", "")
end
Yes, sometime my mind takes convoluted ways...
Your solution is much better, thank you.
The %c is just a lazy way to include \r and \n in less chars... I could
have written ^(%C*)%c*, actually...
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest