GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
octave::string Namespace Reference

Octave string utility functions. More...

Functions

template<typename T >
bool strcmp (const T &str_a, const T &str_b)
 True if strings are the same. More...
 
template<typename T >
bool strcmp (const T &str_a, const typename T::value_type *str_b)
 True if string is the same as character sequence. More...
 
template<typename T >
bool strcmpi (const T &str_a, const T &str_b)
 True if strings are the same, ignoring case. More...
 
template<typename T >
bool strcmpi (const T &str_a, const typename T::value_type *str_b)
 True if string is the same as character sequence, ignoring case. More...
 
template<typename 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. More...
 
template<typename T >
bool strncmp (const T &str_a, const typename T::value_type *str_b, const typename T::size_type n)
 True if the first N characters are the same. More...
 
template<typename T >
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. More...
 
template<typename T >
bool strncmpi (const T &str_a, const typename T::value_type *str_b, const typename T::size_type n)
 True if the first N characters are the same, ignoring case. More...
 

Detailed Description

Octave string utility functions.

This functions provide a C++ interface to most string functions available in the Octave interpreter.

Specializations for Array may consider its dimensions in addition to the actual string contents.

Attention
Octave's string comparison functions return true when strings are are equal, just the opposite of the corresponding C library functions. In addition, Octave's function only return bool and do not check lexicographical order.

Function Documentation

template<typename T >
bool octave::string::strcmp ( const T &  str_a,
const T &  str_b 
)

True if strings are the same.

Specialization for Array<char>

When comparing whole Array of chars, the actual Array dimensions are significant. A column vector and row vector with the same char array, will still return false.

Definition at line 112 of file oct-string.cc.

References numel(), and sizes_cmp().

Referenced by mxArray_struct::get_field_number(), octave_kw_hash::in_word_set(), mxArray_base::is_class(), main(), mexGetVariable(), mexPutVariable(), octave_get_sig_number(), parse_dbfunction_params(), and verror().

template<typename T >
bool octave::string::strcmp ( const T &  str_a,
const typename T::value_type *  str_b 
)

True if string is the same as character sequence.

Compares a string to the null-terminated character sequence beginning at the character pointed to by str_b.

Specialization for Array<char>

For purposes of comparison of dimensions, the character sequence is considered to be a row vector.

Definition at line 120 of file oct-string.cc.

References numel(), and sizes_cmp().

template<typename T >
bool octave::string::strcmpi ( const T &  str_a,
const T &  str_b 
)

True if strings are the same, ignoring case.

Specialization for Array<char>

When comparing whole Array of chars, the actual Array dimensions are significant. A column vector and row vector with the same char array, will still return false.

Definition at line 129 of file oct-string.cc.

References numel(), and sizes_cmp().

Referenced by Feig(), QtHandles::Utils::fromHVAlign(), and Gchol().

template<typename T >
bool octave::string::strcmpi ( const T &  str_a,
const typename T::value_type *  str_b 
)

True if string is the same as character sequence, ignoring case.

Specialization for Array<char>

For purposes of comparison of dimensions, the character sequence is considered to be a row vector.

Definition at line 137 of file oct-string.cc.

References numel(), and sizes_cmp().

template<typename T >
bool octave::string::strncmp ( const T &  str_a,
const T &  str_b,
const typename T::size_type  n 
)

True if the first N characters are the same.

Specialization for Array<char>

The comparison is done in the first N characters, the actual dimensions of the Array are irrelevant. A row vector and a column vector of the same still return true.

Definition at line 146 of file oct-string.cc.

References numel().

Referenced by almost_match(), octave::textscan::lookahead(), read_binary_file_header(), octave::textscan::scan_complex(), and octave::textscan::skip_whitespace().

template<typename T >
bool octave::string::strncmp ( const T &  str_a,
const typename T::value_type *  str_b,
const typename T::size_type  n 
)

True if the first N characters are the same.

Definition at line 155 of file oct-string.cc.

References numel().

template<typename T >
bool octave::string::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.

Specialization for Array<char>

The comparison is done in the first N characters, the actual dimensions of the Array are irrelevant. A row vector and a column vector of the same still return true.

Definition at line 165 of file oct-string.cc.

References numel().

Referenced by get_mapper_fun_options().

template<typename T >
bool octave::string::strncmpi ( const T &  str_a,
const typename T::value_type *  str_b,
const typename T::size_type  n 
)

True if the first N characters are the same, ignoring case.

Definition at line 174 of file oct-string.cc.

References numel().