1######################################################################## 2## 3## Copyright (C) 2017-2021 The Octave Project Developers 4## 5## See the file COPYRIGHT.md in the top-level directory of this 6## distribution or <https://octave.org/copyright/>. 7## 8## This file is part of Octave. 9## 10## Octave is free software: you can redistribute it and/or modify it 11## under the terms of the GNU General Public License as published by 12## the Free Software Foundation, either version 3 of the License, or 13## (at your option) any later version. 14## 15## Octave is distributed in the hope that it will be useful, but 16## WITHOUT ANY WARRANTY; without even the implied warranty of 17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18## GNU General Public License for more details. 19## 20## You should have received a copy of the GNU General Public License 21## along with Octave; see the file COPYING. If not, see 22## <https://www.gnu.org/licenses/>. 23## 24######################################################################## 25 26## -*- texinfo -*- 27## @deftypefn {} {} isstring (@var{s}) 28## Return true if @var{s} is a string array. 29## 30## A string array is a data type that stores strings (row vectors of 31## characters) at each element in the array. It is distinct from character 32## arrays which are N-dimensional arrays where each element is a single 1x1 33## character. It is also distinct from cell arrays of strings which store 34## strings at each element, but use cell indexing @samp{@{@}} to access 35## elements rather than string arrays which use ordinary array indexing 36## @samp{()}. 37## 38## Programming Note: Octave does not yet implement string arrays so this 39## function will always return false. 40## @seealso{ischar, iscellstr, isfloat, isinteger, islogical, isnumeric, isa} 41## @end deftypefn 42 43function retval = isstring (s) 44 45 if (nargin != 1) 46 print_usage (); 47 endif 48 49 retval = false; 50 51endfunction 52 53 54%!assert (isstring ([]), false) 55%!assert (isstring (1), false) 56%!assert (isstring ('a'), false) 57## FIXME: when string arrays are implemented, this should return true. 58#%!assert (isstring ("b"), true) 59%!assert (isstring ({'a'}), false) 60%!assert (isstring ({"b"}), false) 61 62%!error isstring () 63%!error isstring ("a", "b") 64