Mercurial > octave-antonio
diff scripts/strings/strtrim.m @ 8442:502e58a0d44f
Fix docstrings, add examples, references and tests to string functions
author | Thorsten Meyer <thorsten.meyier@gmx.de> |
---|---|
date | Mon, 05 Jan 2009 08:11:03 +0100 |
parents | 693ac94c2854 |
children | eb63fbe60fab |
line wrap: on
line diff
--- a/scripts/strings/strtrim.m Tue Dec 30 00:25:20 2008 -0500 +++ b/scripts/strings/strtrim.m Mon Jan 05 08:11:03 2009 +0100 @@ -21,7 +21,17 @@ ## Remove leading and trailing blanks and nulls from @var{s}. If ## @var{s} is a matrix, @var{strtrim} trims each row to the length of ## longest string. If @var{s} is a cell array, operate recursively on -## each element of the cell array. +## each element of the cell array. For example: +## +## @example +## @group +## strtrim (" abc ") +## @result{} "abc" +## +## strtrim ([" abc "; " def "]) +## @result{} ["abc "; " def"] +## @end group +## @end example ## @end deftypefn ## Author: John Swensen <jpswensen@jhu.edu> @@ -52,3 +62,8 @@ endif endfunction + +%!error <Invalid call to strtrim> strtrim(); +%!error <Invalid call to strtrim> strtrim("abc", "def"); +%!assert (strtrim (" abc "), "abc"); +%!assert (strtrim ([" abc "; " def "]), ["abc "; " def"]);