22 #if defined (HAVE_CONFIG_H) 37 str_data_cmp (
const typename T::value_type *
a,
const typename T::value_type *
b,
38 const typename T::size_type n)
40 for (
typename T::size_type
i = 0;
i < n; ++
i)
49 const typename T::size_type n)
51 for (
typename T::size_type
i = 0;
i < n; ++
i)
52 if (std::tolower (
a[
i]) != std::tolower (
b[
i]))
84 return str_a.size () == str_b.size ();
91 return str_a.
dims () == str_b.
dims ();
96 sizes_cmp (
const T& str_a,
const typename T::value_type *str_b)
98 return str_a.size () == strlen<T> (str_b);
106 && str_a.
numel () == strlen<Array<char>> (str_b));
115 && str_data_cmp<T> (str_a.data (), str_b.data (),
numel (str_a)));
123 && str_data_cmp<T> (str_a.data (), str_b,
numel (str_a)));
132 && str_data_cmpi<T> (str_a.data (), str_b.data (),
numel (str_a)));
140 && str_data_cmpi<T> (str_a.data (), str_b,
numel (str_a)));
147 const typename T::size_type n)
149 return (
numel (str_a) >= n &&
numel (str_b) >= n
150 && str_data_cmp<T> (str_a.data (), str_b.data (), n));
156 const typename T::size_type n)
158 return (
numel (str_a) >= n && strlen<T> (str_b) >= n
159 && str_data_cmp<T> (str_a.data (), str_b, n));
166 const typename T::size_type n)
168 return (
numel (str_a) >= n &&
numel (str_b) >= n
169 && str_data_cmpi<T> (str_a.data (), str_b.data (), n));
175 const typename T::size_type n)
177 return (
numel (str_a) >= n && strlen<T> (str_b) >= n
178 && str_data_cmpi<T> (str_a.data (), str_b, n));
183 #define INSTANTIATE_OCTAVE_STRING(T) \ 184 template bool octave::string::strcmp<T> (const T&, const T&); \ 185 template bool octave::string::strcmp<T> (const T&, \ 186 const typename T::value_type*); \ 187 template bool octave::string::strcmpi<T> (const T&, const T&); \ 188 template bool octave::string::strcmpi<T> (const T&, \ 189 const typename T::value_type*); \ 190 template bool octave::string::strncmp<T> (const T&, const T&, \ 191 const typename T::size_type); \ 192 template bool octave::string::strncmp<T> (const T&, \ 193 const typename T::value_type*, \ 194 const typename T::size_type); \ 195 template bool octave::string::strncmpi<T> (const T&, const T&, \ 196 const typename T::size_type n); \ 197 template bool octave::string::strncmpi<T> (const T&, \ 198 const typename T::value_type*, \ 199 const typename T::size_type); 206 #undef INSTANTIATE_OCTAVE_STRING octave_idx_type rows(void) const
static bool str_data_cmp(const typename T::value_type *a, const typename T::value_type *b, const typename T::size_type n)
bool isvector(void) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
bool strcmp(const T &str_a, const T &str_b)
True if strings are the same.
bool sizes_cmp(const T &str_a, const T &str_b)
T::size_type strlen(const typename T::value_type *str)
static bool str_data_cmpi(const typename T::value_type *a, const typename T::value_type *b, const typename T::size_type n)
T::size_type numel(const T &str)
bool strcmpi(const T &str_a, const T &str_b)
True if strings are the same, ignoring case.
#define INSTANTIATE_OCTAVE_STRING(T)
bool strncmp(const T &str_a, const T &str_b, const typename T::size_type n)
True if the first N characters are the same.
octave_idx_type numel(void) const
Number of elements in the array.
bool strncmpi(const T &str_a, const T &str_b, const typename T::size_type n)
True if the first N characters are the same, ignoring case.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string