Philippe Lhoste wrote:
Srish Agrawal a écrit :
Hello EveryBody

I needed a small LUA script to be used with SciTE. It was supposed to remove all multilple lines except the first one from a text document without changing the original document in any other way. Unable to find a similer script posted
anywhere on the NET, I wrote it myself.
[snip][snip]

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

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to