doc nit redux

17 views
Skip to first unread message

tooth pik

unread,
Mar 23, 2018, 12:55:37 PM3/23/18
to vim...@googlegroups.com
excuse me but really:  echo trim("rm<blob1><blob2><any_chars>rrmm<blob1><blob2><blob2>", "rm<blob1><blob2>")
echoes "any_chars" not any_chas

trim() is intended, and does, remove characters from the
beginning and/or end of strings, not out of the middle

I need to learn to have more faith in myself

Christ van Willegen

unread,
Mar 23, 2018, 2:50:34 PM3/23/18
to vim...@googlegroups.com
Hi,



Op vr 23 mrt. 2018 17:55 schreef tooth pik <toot...@gmail.com>:

If you tested it, I'm sure you've seen the result. I only looked at the docs, wondered about the missing "r" and thought "that's because it's part of the mask and the rest of the result isn't". So, I was wrong and this does look like a doc bug!

Christ van Willegen

Bram Moolenaar

unread,
Mar 23, 2018, 5:10:59 PM3/23/18
to vim...@googlegroups.com, tooth pik
I noticed last moment that this is not a good example, doesn't really
help the user understand how it works. This should be better:

Examples: >
echo trim(" some text ")
< returns "some text" >
echo trim(" \r\t\t\r RESERVE \t\n\x0B\xA0") . "_TAIL"
< returns "RESERVE_TAIL" >
echo trim("rm<Xrm<>X>rrm", "rm<>")
< returns "Xrm<>X" (characters in the middle are not removed)


--
Well, you come from nothing, you go back to nothing... What have you
lost? Nothing!
-- Monty Python: The life of Brian

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages