Mercurial > octave
annotate scripts/strings/isstring.m @ 27923:bd51beb6205e
update formatting of copyright notices
* Use <https://octave.org/copyright/> instead of
<https://octave.org/COPYRIGHT.html/>.
* For consistency with other comments in the Octave sources, use
C++-style comments for copyright blocks in C and C++ files.
* Use delimiters above and below copyright blocks that are appropriate
for the language used in the file.
* Eliminate extra spacing inside copyright blocks.
* lex.ll (looks_like_copyright): Also allow newlines and carriage
returns before the word "Copyright".
* scripts/mk-doc.pl (gethelp): Also skip empty comment lines.
* bp-table.cc, type.m: Adjust tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jan 2020 11:59:41 -0500 |
parents | 1891570abac8 |
children | d8318c12d903 0a5b15007766 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2017-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24474
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24474
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## (at your option) any later version. |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
18 ## GNU General Public License for more details. |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
19 ## |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24474
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
25 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
25039
40a65b30fadf
maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents:
24985
diff
changeset
|
27 ## @deftypefn {} {} isstring (@var{s}) |
40a65b30fadf
maint: Match variable names in documentation to those in function prototype.
Rik <rik@octave.org>
parents:
24985
diff
changeset
|
28 ## Return true if @var{s} is a string array. |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
29 ## |
24985
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
30 ## A string array is a data type that stores strings (row vectors of |
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
31 ## characters) at each element in the array. It is distinct from character |
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
32 ## arrays which are N-dimensional arrays where each element is a single 1x1 |
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
33 ## character. It is also distinct from cell arrays of strings which store |
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
34 ## strings at each element, but use cell indexing @samp{@{@}} to access |
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
35 ## elements rather than string arrays which use ordinary array indexing |
d85b2485af9e
doc: grammarcheck m-files ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
36 ## @samp{()}. |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
37 ## |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
38 ## Programming Note: Octave does not yet implement string arrays so this |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
39 ## function will always return false. |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
40 ## @seealso{ischar, iscellstr, isfloat, isinteger, islogical, isnumeric, isa} |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
41 ## @end deftypefn |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
42 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
43 function retval = isstring (s) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
44 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
45 if (nargin != 1) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
46 print_usage (); |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
47 endif |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
48 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
49 retval = false; |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
50 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
51 endfunction |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
52 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
53 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
54 %!assert (isstring ([]), false) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
55 %!assert (isstring (1), false) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
56 %!assert (isstring ('a'), false) |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
57 ## FIXME: when string arrays are implemented, this should return true. |
24474
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
58 #%!assert (isstring ("b"), true) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
59 %!assert (isstring ({'a'}), false) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
60 %!assert (isstring ({"b"}), false) |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
61 |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
62 %!error isstring () |
0b65949870e3
isstring.m: Add new function for identifying string arrays.
Rik <rik@octave.org>
parents:
diff
changeset
|
63 %!error isstring ("a", "b") |