-
Notifications
You must be signed in to change notification settings - Fork 254
Open
Milestone
Description
Hello,
The indent and dedent functions both add a final "\n" sequence at the end of the string.
Code reference of the indent function:
Lines 500 to 514 in b101290
--- indent a multiline string. | |
-- @tparam string s the (multiline) string | |
-- @tparam integer n the size of the indent | |
-- @tparam[opt=' '] string ch the character to use when indenting | |
-- @return indented string | |
function stringx.indent (s,n,ch) | |
assert_arg(1,s,'string') | |
assert_arg(2,n,'number') | |
local lines = usplit(s ,'\n') | |
local prefix = string.rep(ch or ' ',n) | |
for i, line in ipairs(lines) do | |
lines[i] = prefix..line | |
end | |
return concat(lines,'\n')..'\n' | |
end |
I think this extra "\n" sequence shouldn't be here. It's not part of the functions documentations and is (at least in my use case) unwanted.
Metadata
Metadata
Assignees
Labels
No labels