annotate scripts/strings/isstrprop.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
1 ## Copyright (C) 2008-2015 John W. Eaton
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 ##
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 ## This file is part of Octave.
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 ##
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 ## your option) any later version.
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 ##
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ## General Public License for more details.
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ## -*- texinfo -*-
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
20 ## @deftypefn {Function File} {} isstrprop (@var{str}, @var{prop})
20164
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
21 ## Test character string properties.
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
22 ##
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
23 ## For example:
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 ##
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 ## @example
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 ## @group
8442
502e58a0d44f Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7530
diff changeset
27 ## isstrprop ("abc123", "alpha")
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 ## @result{} [1, 1, 1, 0, 0, 0]
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 ## @end group
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 ## @end example
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
31 ##
20164
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
32 ## If @var{str} is a cell array, @code{isstrpop} is applied recursively to
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
33 ## each element of the cell array.
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 ##
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 ## Numeric arrays are converted to character strings.
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 ##
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
37 ## The second argument @var{prop} must be one of
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 ##
11595
5ec6aa05638d Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents: 11591
diff changeset
39 ## @table @asis
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
40 ## @item @qcode{"alpha"}
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
41 ## True for characters that are alphabetic (letters).
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
43 ## @item @qcode{"alnum"}
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
44 ## @itemx @qcode{"alphanum"}
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 ## True for characters that are alphabetic or digits.
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
46 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
47 ## @item @qcode{"lower"}
12642
f96b9b9f141b doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
48 ## True for lowercase letters.
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
49 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
50 ## @item @qcode{"upper"}
12642
f96b9b9f141b doc: Periodic grammarcheck and spellcheck of documentation.
Rik <octave@nomad.inbox5.com>
parents: 11595
diff changeset
51 ## True for uppercase letters.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
52 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
53 ## @item @qcode{"digit"}
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
54 ## True for decimal digits (0-9).
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
55 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
56 ## @item @qcode{"xdigit"}
11591
1d13679b587e Use @nospell macro on certain words in docstrings.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
57 ## True for hexadecimal digits (@nospell{a-fA-F0-9}).
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
58 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
59 ## @item @qcode{"space"}
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
60 ## @itemx @qcode{"wspace"}
20164
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
61 ## True for whitespace characters (space, formfeed, newline, carriage return,
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
62 ## tab, vertical tab).
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
63 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
64 ## @item @qcode{"punct"}
20164
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
65 ## True for punctuation characters (printing characters except space or
df437a52bcaf doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
66 ## letter or digit).
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
67 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
68 ## @item @qcode{"cntrl"}
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
69 ## True for control characters.
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
70 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
71 ## @item @qcode{"graph"}
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
72 ## @itemx @qcode{"graphic"}
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
73 ## True for printing characters except space.
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
74 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
75 ## @item @qcode{"print"}
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
76 ## True for printing characters including space.
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
77 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17170
diff changeset
78 ## @item @qcode{"ascii"}
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
79 ## True for characters that are in the range of ASCII encoding.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
80 ##
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 ## @end table
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 ##
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
83 ## @seealso{isalpha, isalnum, islower, isupper, isdigit, isxdigit,
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
84 ## isspace, ispunct, iscntrl, isgraph, isprint, isascii}
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 ## @end deftypefn
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
87 function retval = isstrprop (str, prop)
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88
13312
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
89 if (nargin != 2)
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 print_usage ();
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 endif
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92
13312
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
93 switch (prop)
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
94 case "alpha"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
95 retval = isalpha (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
96 case {"alnum", "alphanum"}
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
97 retval = isalnum (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
98 case "ascii"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
99 retval = isascii (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
100 case "cntrl"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
101 retval = iscntrl (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
102 case "digit"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
103 retval = isdigit (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
104 case {"graph", "graphic"}
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
105 retval = isgraph (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
106 case "lower"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
107 retval = islower (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
108 case "print"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
109 retval = isprint (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
110 case "punct"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
111 retval = ispunct (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
112 case {"space", "wspace"}
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
113 retval = isspace (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
114 case "upper"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
115 retval = isupper (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
116 case "xdigit"
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
117 retval = isxdigit (str);
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
118 otherwise
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
119 error ("isstrprop: invalid string property");
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
120 endswitch
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
121
7530
bb0f2353cff5 new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 endfunction
8442
502e58a0d44f Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7530
diff changeset
123
13312
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
124
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
125 %!assert (isstrprop ("abc123", "alpha"), logical ([1, 1, 1, 0, 0, 0]))
13312
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
126 %!assert (isstrprop ("abc123", "digit"), logical ([0, 0, 0, 1, 1, 1]))
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
127 %!assert (isstrprop ("Hello World", "wspace"), isspace ("Hello World"))
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
128 %!assert (isstrprop ("Hello World", "graphic"), isgraph ("Hello World"))
13312
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
129 %!assert (isstrprop (char ("AbC", "123"), "upper"), logical ([1 0 1; 0 0 0]))
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
130 %!assert (isstrprop ({"AbC", "123"}, "lower"), {logical([0 1 0]), logical([0 0 0])})
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
131
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
132 ## Test input validation
11431
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
133 %!error isstrprop ()
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
134 %!error isstrprop ("abc123")
0d9640d755b1 Improve docstrings for all isXXX functions.
Rik <octave@nomad.inbox5.com>
parents: 10821
diff changeset
135 %!error isstrprop ("abc123", "alpha", "alpha")
13312
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
136 %!error <invalid string property> isstrprop ("abc123", "foo")
e84d512b2438 isstrprop.m: Put input validation first and add a few more tests.
Rik <octave@nomad.inbox5.com>
parents: 12642
diff changeset
137