Mercurial > octave-antonio
annotate scripts/strings/ostrsplit.m @ 20164:df437a52bcaf stable
doc: Update more docstrings to have one sentence summary as first line.
Reviewed miscellaneous, sparse, strings in scripts directory.
* scripts/miscellaneous/bzip2.m, scripts/miscellaneous/citation.m,
scripts/miscellaneous/compare_versions.m, scripts/miscellaneous/computer.m,
scripts/miscellaneous/debug.m, scripts/miscellaneous/dir.m,
scripts/miscellaneous/edit.m, scripts/miscellaneous/error_ids.m,
scripts/miscellaneous/fileattrib.m, scripts/miscellaneous/fullfile.m,
scripts/miscellaneous/genvarname.m, scripts/miscellaneous/gzip.m,
scripts/miscellaneous/mkoctfile.m, scripts/miscellaneous/news.m,
scripts/miscellaneous/open.m, scripts/miscellaneous/parseparams.m,
scripts/miscellaneous/recycle.m, scripts/miscellaneous/run.m,
scripts/miscellaneous/swapbytes.m, scripts/miscellaneous/tar.m,
scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m,
scripts/miscellaneous/what.m, scripts/sparse/bicg.m, scripts/sparse/bicgstab.m,
scripts/sparse/cgs.m, scripts/sparse/colperm.m, scripts/sparse/eigs.m,
scripts/sparse/etreeplot.m, scripts/sparse/gmres.m, scripts/sparse/gplot.m,
scripts/sparse/ichol.m, scripts/sparse/ilu.m, scripts/sparse/pcg.m,
scripts/sparse/pcr.m, scripts/sparse/qmr.m, scripts/sparse/spaugment.m,
scripts/sparse/spconvert.m, scripts/sparse/spdiags.m, scripts/sparse/spfun.m,
scripts/sparse/spones.m, scripts/sparse/sprandsym.m, scripts/sparse/spstats.m,
scripts/sparse/spy.m, scripts/sparse/svds.m, scripts/sparse/treelayout.m,
scripts/sparse/treeplot.m, scripts/strings/base2dec.m,
scripts/strings/bin2dec.m, scripts/strings/blanks.m, scripts/strings/cstrcat.m,
scripts/strings/deblank.m, scripts/strings/dec2base.m,
scripts/strings/dec2bin.m, scripts/strings/dec2hex.m,
scripts/strings/findstr.m, scripts/strings/hex2dec.m, scripts/strings/index.m,
scripts/strings/isletter.m, scripts/strings/isstrprop.m,
scripts/strings/mat2str.m, scripts/strings/ostrsplit.m,
scripts/strings/regexptranslate.m, scripts/strings/rindex.m,
scripts/strings/str2num.m, scripts/strings/strcat.m, scripts/strings/strchr.m,
scripts/strings/strjoin.m, scripts/strings/strjust.m,
scripts/strings/strmatch.m, scripts/strings/strsplit.m,
scripts/strings/strtok.m, scripts/strings/strtrim.m,
scripts/strings/strtrunc.m, scripts/strings/substr.m,
scripts/strings/untabify.m, scripts/time/datenum.m:
Update more docstrings to have one sentence summary as first line.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 May 2015 14:22:02 -0700 |
parents | 9fc020886ae9 |
children |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19593
diff
changeset
|
1 ## Copyright (C) 2009-2015 Jaroslav Hajek |
16723
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
2 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
4 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
8 ## your option) any later version. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
9 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
13 ## General Public License for more details. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
14 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
18 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{cstr}] =} ostrsplit (@var{s}, @var{sep}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
21 ## @deftypefnx {Function File} {[@var{cstr}] =} ostrsplit (@var{s}, @var{sep}, @var{strip_empty}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
22 ## Split the string @var{s} using one or more separators @var{sep} and return |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
23 ## a cell array of strings. |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
24 ## |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
25 ## Consecutive separators and separators at boundaries result in empty |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
26 ## strings, unless @var{strip_empty} is true. The default value of |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19833
diff
changeset
|
27 ## @var{strip_empty} is false. |
16723
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
28 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
29 ## 2-D character arrays are split at separators and at the original column |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
30 ## boundaries. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
31 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
32 ## Example: |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
33 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
34 ## @example |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
35 ## @group |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
36 ## ostrsplit ("a,b,c", ",") |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
37 ## @result{} |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
38 ## @{ |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
39 ## [1,1] = a |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
40 ## [1,2] = b |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
41 ## [1,3] = c |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
42 ## @} |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
43 ## |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
44 ## ostrsplit (["a,b" ; "cde"], ",") |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
45 ## @result{} |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
46 ## @{ |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
47 ## [1,1] = a |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
48 ## [1,2] = b |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
49 ## [1,3] = cde |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
50 ## @} |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
51 ## @end group |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
52 ## @end example |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
53 ## @seealso{strsplit, strtok} |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
54 ## @end deftypefn |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
55 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
56 function cstr = ostrsplit (s, sep, strip_empty = false) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
57 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
58 if (nargin < 2 || nargin > 3) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
59 print_usage (); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
60 elseif (! ischar (s) || ! ischar (sep)) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
61 error ("ostrsplit: S and SEP must be string values"); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
62 elseif (! isscalar (strip_empty)) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
63 error ("ostrsplit: STRIP_EMPTY must be a scalar value"); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
64 endif |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
65 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
66 if (isempty (s)) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
67 cstr = cell (size (s)); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
68 else |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
69 if (rows (s) > 1) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
70 ## For 2-D arrays, add separator character at line boundaries |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
71 ## and transform to single string |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
72 s(:, end+1) = sep(1); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
73 s = reshape (s.', 1, numel (s)); |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
74 s(end) = []; |
16723
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
75 endif |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
76 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
77 ## Split s according to delimiter |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
78 if (isscalar (sep)) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
79 ## Single separator |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
80 idx = find (s == sep); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
81 else |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
82 ## Multiple separators |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
83 idx = strchr (s, sep); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
84 endif |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
85 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
86 ## Get substring lengths. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
87 if (isempty (idx)) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
88 strlens = length (s); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
89 else |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
90 strlens = [idx(1)-1, diff(idx)-1, numel(s)-idx(end)]; |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
91 endif |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
92 ## Remove separators. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
93 s(idx) = []; |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
94 if (strip_empty) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
95 ## Omit zero lengths. |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
96 strlens = strlens(strlens != 0); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
97 endif |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
98 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
99 ## Convert! |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
100 cstr = mat2cell (s, 1, strlens); |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
101 endif |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
102 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
103 endfunction |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
104 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
105 |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
106 %!assert (ostrsplit ("road to hell", " "), {"road", "to", "hell"}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
107 %!assert (ostrsplit ("road to^hell", " ^"), {"road", "to", "hell"}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
108 %!assert (ostrsplit ("road to--hell", " -", true), {"road", "to", "hell"}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
109 %!assert (ostrsplit (["a,bc";",de"], ","), {"a", "bc", char(ones(1,0)), "de "}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
110 %!assert (ostrsplit (["a,bc";",de"], ",", true), {"a", "bc", "de "}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
111 %!assert (ostrsplit (["a,bc";",de"], ", ", true), {"a", "bc", "de"}) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
112 |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
113 ## Test input validation |
16723
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
114 %!error ostrsplit () |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
115 %!error ostrsplit ("abc") |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
116 %!error ostrsplit ("abc", "b", true, 4) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
117 %!error <S and SEP must be string values> ostrsplit (123, "b") |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
118 %!error <S and SEP must be string values> ostrsplit ("abc", 1) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
119 %!error <STRIP_EMPTY must be a scalar value> ostrsplit ("abc", "def", ones (3,3)) |
45b57ac44854
Re-introduce the original strsplit() as ostrsplit().
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
120 |