Octave string utility functions. More...
Enumerations | |
enum | u8_fallback_type { U8_REPLACEMENT_CHAR , U8_ISO_8859_1 } |
Functions | |
OCTAVE_API Complex | str2double (const std::string &str_arg) |
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... | |
OCTAVE_API std::string | u8_from_encoding (const std::string &who, const std::string &native_string, const std::string &encoding) |
OCTAVE_API std::string | u8_to_encoding (const std::string &who, const std::string &u8_string, const std::string &encoding) |
OCTAVE_API unsigned int | u8_validate (const std::string &who, std::string &in_string, const u8_fallback_type type=U8_REPLACEMENT_CHAR) |
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.
Enumerator | |
---|---|
U8_REPLACEMENT_CHAR | |
U8_ISO_8859_1 |
Definition at line 141 of file oct-string.h.
Complex octave::string::str2double | ( | const std::string & | str_arg | ) |
Definition at line 460 of file oct-string.cc.
References extract_num(), NaN, and set_component().
Referenced by QtHandles::attempt_type_conversion(), and Fstr2double().
bool octave::string::strcmp | ( | const T & | str_a, |
const T & | str_b | ||
) |
True if strings are the same.
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 122 of file oct-string.cc.
References numel(), and sizes_cmp().
Referenced by mxArray_struct::get_field_number(), mxArray_base::is_class(), main(), mexGetVariable(), mexPutVariable(), octave_get_sig_number(), octave::bp_table::parse_dbfunction_params(), and strcmp_ignore_n().
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.
For purposes of comparison of dimensions, the character sequence is considered to be a row vector.
Definition at line 130 of file oct-string.cc.
References numel(), and sizes_cmp().
bool octave::string::strcmpi | ( | const T & | str_a, |
const T & | str_b | ||
) |
True if strings are the same, ignoring case.
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 139 of file oct-string.cc.
References numel(), and sizes_cmp().
Referenced by Fchol(), Feig(), QtHandles::Utils::fromHVAlign(), and strcmpi_ignore_n().
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.
For purposes of comparison of dimensions, the character sequence is considered to be a row vector.
Definition at line 147 of file oct-string.cc.
References numel(), and sizes_cmp().
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.
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 156 of file oct-string.cc.
References max(), min(), n, and numel().
Referenced by octave::almost_match(), Fstrncmp(), octave::textscan::lookahead(), octave::read_binary_file_header(), octave::textscan::scan_complex(), and octave::textscan::skip_whitespace().
bool octave::string::strncmp | ( | const T & | str_a, |
const typename T::value_type * | str_b, | ||
const typename T::size_type | n | ||
) |
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.
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 185 of file oct-string.cc.
References max(), min(), n, and numel().
Referenced by Fstrncmpi(), and get_mapper_fun_options().
bool octave::string::strncmpi | ( | const T & | str_a, |
const typename T::value_type * | str_b, | ||
const typename T::size_type | n | ||
) |
std::string octave::string::u8_from_encoding | ( | const std::string & | who, |
const std::string & | native_string, | ||
const std::string & | encoding | ||
) |
Definition at line 528 of file oct-string.cc.
References octave::action_container::add_fcn(), current_liboctave_error_handler, free(), octave::jit_convention::length, octave_u8_conv_from_encoding(), and retval.
Referenced by octave::base_stream::do_gets(), octave::textscan::scan_cstring(), octave::textscan::scan_qstring(), and octave::textscan::scan_string().
std::string octave::string::u8_to_encoding | ( | const std::string & | who, |
const std::string & | u8_string, | ||
const std::string & | encoding | ||
) |
Definition at line 495 of file oct-string.cc.
References octave::action_container::add_fcn(), current_liboctave_error_handler, free(), octave::jit_convention::length, octave_u8_conv_to_encoding(), and retval.
Referenced by octave::base_stream::do_printf(), octave::do_printf_string(), and octave::vformat().
unsigned int octave::string::u8_validate | ( | const std::string & | who, |
std::string & | in_string, | ||
const u8_fallback_type | type = U8_REPLACEMENT_CHAR |
||
) |
Definition at line 559 of file oct-string.cc.
References octave::action_container::add_fcn(), free(), octave_u8_check_wrapper(), octave_u8_conv_from_encoding(), U8_ISO_8859_1, and U8_REPLACEMENT_CHAR.
Referenced by F__u8_validate__().