comparison scripts/strings/strtrim.m @ 12981:4ec4096f65d1

doc: State that required input is cellstr, not cell, for strtrim and deblank (Bug #34038) NEWS: Note incompatible changes to certain string functions since 3.4.2 deblank.m, strtrim.m: Document that cellstr, not cell, is required input.
author Rik <octave@nomad.inbox5.com>
date Sun, 21 Aug 2011 21:44:39 -0700
parents f89449967f0d
children a1049e4480f8
comparison
equal deleted inserted replaced
12980:421f2030bb76 12981:4ec4096f65d1
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {} strtrim (@var{s}) 20 ## @deftypefn {Function File} {} strtrim (@var{s})
21 ## Remove leading and trailing whitespace from @var{s}. If 21 ## Remove leading and trailing whitespace from @var{s}. If
22 ## @var{s} is a matrix, @var{strtrim} trims each row to the length of 22 ## @var{s} is a matrix, @var{strtrim} trims each row to the length of
23 ## longest string. If @var{s} is a cell array, operate recursively on 23 ## longest string. If @var{s} is a cell array of strings, operate recursively
24 ## each element of the cell array. For example: 24 ## on each string element. For example:
25 ## 25 ##
26 ## @example 26 ## @example
27 ## @group 27 ## @group
28 ## strtrim (" abc ") 28 ## strtrim (" abc ")
29 ## @result{} "abc" 29 ## @result{} "abc"
30 ## 30 ##
31 ## strtrim ([" abc "; " def "]) 31 ## strtrim ([" abc "; " def "])
32 ## @result{} ["abc "; " def"] 32 ## @result{} ["abc " ; " def"]
33 ## @end group 33 ## @end group
34 ## @end example 34 ## @end example
35 ## @seealso{deblank}
35 ## @end deftypefn 36 ## @end deftypefn
36 37
37 ## Author: John Swensen <jpswensen@jhu.edu> 38 ## Author: John Swensen <jpswensen@jhu.edu>
38 39
39 ## This function was derived from deblank. 40 ## This function was derived from deblank.
71 %!assert (strtrim ({" abc "; " def "}), {"abc"; "def"}); 72 %!assert (strtrim ({" abc "; " def "}), {"abc"; "def"});
72 73
73 %!error <Invalid call to strtrim> strtrim (); 74 %!error <Invalid call to strtrim> strtrim ();
74 %!error <Invalid call to strtrim> strtrim ("abc", "def"); 75 %!error <Invalid call to strtrim> strtrim ("abc", "def");
75 %!error <argument must be a string> strtrim (1); 76 %!error <argument must be a string> strtrim (1);
77 %!error <argument must be a string> strtrim ({[]});
76 78