comparison src/strfns.cc @ 9307:c2923c27c877

Various documentation improvements
author Rik <rdrider0-list@yahoo.com>
date Sat, 06 Jun 2009 18:30:52 -0700
parents 7c02ec148a3c
children 06e11df4592d
comparison
equal deleted inserted replaced
9306:de124edcebf6 9307:c2923c27c877
41 #include "unwind-prot.h" 41 #include "unwind-prot.h"
42 #include "utils.h" 42 #include "utils.h"
43 43
44 DEFUN (char, args, , 44 DEFUN (char, args, ,
45 "-*- texinfo -*-\n\ 45 "-*- texinfo -*-\n\
46 @deftypefn {Built-in Function} {} char (@var{x})\n\ 46 @deftypefn {Built-in Function} {} char (@var{x})\n\
47 @deftypefnx {Built-in Function} {} char (@var{x}, @dots{})\n\
48 @deftypefnx {Built-in Function} {} char (@var{s1}, @var{s2}, @dots{})\n\
47 @deftypefnx {Built-in Function} {} char (@var{cell_array})\n\ 49 @deftypefnx {Built-in Function} {} char (@var{cell_array})\n\
48 @deftypefnx {Built-in Function} {} char (@var{s1}, @var{s2}, @dots{})\n\
49 Create a string array from one or more numeric matrices, character\n\ 50 Create a string array from one or more numeric matrices, character\n\
50 matrices or cell arrays. For numerical input, each element is converted\n\ 51 matrices, or cell arrays. Arguments are concatenated vertically.\n\
51 to the corresponding ASCII character. The arguments (and elements of\n\
52 cell array(s)) are concatenated vertically.\n\
53 The returned values are padded with blanks as needed to make each row\n\ 52 The returned values are padded with blanks as needed to make each row\n\
54 of the string array have the same length. Empty strings are not removed.\n\ 53 of the string array have the same length. Empty input strings are\n\
54 significant and will concatenated in the output.\n\
55 \n\
56 For numerical input, each element is converted\n\
57 to the corresponding ASCII character. A range error results if an input\n\
58 is outside the ASCII range (0-255).\n\
59 \n\
60 For cell arrays, each element is concatenated separately. Cell arrays converted through\n\
61 @code{char} can mostly be converted back with @code{cellstr}.\n\
55 For example,\n\ 62 For example,\n\
56 \n\ 63 \n\
57 @example\n\ 64 @example\n\
58 @group\n\ 65 @group\n\
59 char ([97, 98, 99], \"\", @{\"98\", \"99\", 100@}, [\"num\", \"bers\"])\n\ 66 char ([97, 98, 99], \"\", @{\"98\", \"99\", 100@}, \"str1\", [\"ha\", \"lf\"])\n\
60 @result{} [\"abc \"\n\ 67 @result{} [\"abc \"\n\
61 \" \"\n\ 68 \" \"\n\
62 \"98 \"\n\ 69 \"98 \"\n\
63 \"99 \"\n\ 70 \"99 \"\n\
64 \"d \"\n\ 71 \"d \"\n\
65 \"numbers\"]\n\ 72 \"str1 \"\n\
73 \"half \"]\n\
66 @end group\n\ 74 @end group\n\
67 @end example\n\ 75 @end example\n\
68 \n\ 76 @seealso{strvcat, cellstr}\n\
69 @end deftypefn") 77 @end deftypefn")
70 { 78 {
71 octave_value retval; 79 octave_value retval;
72 80
73 int nargin = args.length (); 81 int nargin = args.length ();
156 %!assert(strcmp (char ("a", "bb", "ccc"), ["a "; "bb "; "ccc"])); 164 %!assert(strcmp (char ("a", "bb", "ccc"), ["a "; "bb "; "ccc"]));
157 */ 165 */
158 166
159 DEFUN (strvcat, args, , 167 DEFUN (strvcat, args, ,
160 "-*- texinfo -*-\n\ 168 "-*- texinfo -*-\n\
161 @deftypefn {Built-in Function} {} strvcat (@var{x})\n\ 169 @deftypefn {Built-in Function} {} strvcat (@var{x})\n\
170 @deftypefnx {Built-in Function} {} strvcat (@var{x}, @dots{})\n\
171 @deftypefnx {Built-in Function} {} strvcat (@var{s1}, @var{s2}, @dots{})\n\
162 @deftypefnx {Built-in Function} {} strvcat (@var{cell_array})\n\ 172 @deftypefnx {Built-in Function} {} strvcat (@var{cell_array})\n\
163 @deftypefnx {Built-in Function} {} strvcat (@var{s1}, @var{s2}, @dots{})\n\
164 Create a character array from one or more numeric matrices, character\n\ 173 Create a character array from one or more numeric matrices, character\n\
165 matrices or cell arrays. For numerical input, each element is converted\n\ 174 matrices, or cell arrays. Arguments are concatenated vertically.\n\
166 to the corresponding ASCII character. The arguments (and elements of\n\
167 cell array(s)) are concatenated vertically.\n\
168 The returned values are padded with blanks as needed to make each row\n\ 175 The returned values are padded with blanks as needed to make each row\n\
169 of the string array have the same length. Unlike @code{char}, empty\n\ 176 of the string array have the same length. Unlike @code{char}, empty\n\
170 strings are removed.\n\ 177 strings are removed and will not appear in the output.\n\
178 \n\
179 For numerical input, each element is converted\n\
180 to the corresponding ASCII character. A range error results if an input\n\
181 is outside the ASCII range (0-255).\n\
182 \n\
183 For cell arrays, each element is concatenated separately. Cell arrays converted through\n\
184 @code{strvcat} can mostly be converted back with @code{cellstr}.\n\
171 For example,\n\ 185 For example,\n\
172 \n\ 186 \n\
173 @example\n\ 187 @example\n\
174 @group\n\ 188 @group\n\
175 strvcat ([97, 98, 99], \"\", @{\"98\", \"99\", 100@}, [\"num\", \"bers\"])\n\ 189 strvcat ([97, 98, 99], \"\", @{\"98\", \"99\", 100@}, \"str1\", [\"ha\", \"lf\"])\n\
176 @result{} [\"abc \"\n\ 190 @result{} [\"abc \"\n\
177 \"98 \"\n\ 191 \"98 \"\n\
178 \"99 \"\n\ 192 \"99 \"\n\
179 \"d \"\n\ 193 \"d \"\n\
180 \"numbers\"]\n\ 194 \"str1 \"\n\
195 \"half \"]\n\
181 @end group\n\ 196 @end group\n\
182 @end example\n\ 197 @end example\n\
183 \n\
184 @seealso{char, strcat, cstrcat}\n\ 198 @seealso{char, strcat, cstrcat}\n\
185 @end deftypefn") 199 @end deftypefn")
186 { 200 {
187 octave_value retval; 201 octave_value retval;
188 202