GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-string.h File Reference
#include "octave-config.h"
#include <locale>
#include "oct-cmplx.h"
Include dependency graph for oct-string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  codecvt_u8
 
struct  deletable_facet< Facet >
 

Enumerations

enum  u8_fallback_type { U8_REPLACEMENT_CHAR , U8_ISO_8859_1 }
 

Functions

template<typename T >
OCTAVE_API std::string rational_approx (T val, int len)
 
OCTAVE_API Complex str2double (const std::string &str_arg)
 
template<typename T >
OCTAVE_API bool strcmp (const T &str_a, const T &str_b)
 Octave string utility functions. More...
 
template<typename T >
OCTAVE_API 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 >
OCTAVE_API bool strcmpi (const T &str_a, const T &str_b)
 True if strings are the same, ignoring case. More...
 
template<typename T >
OCTAVE_API 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 >
OCTAVE_API 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 >
OCTAVE_API 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 >
OCTAVE_API 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 >
OCTAVE_API 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)
 

Enumeration Type Documentation

◆ u8_fallback_type

Enumerator
U8_REPLACEMENT_CHAR 
U8_ISO_8859_1 

Definition at line 151 of file oct-string.h.

Function Documentation

◆ rational_approx()

template<typename T >
OCTAVE_API std::string rational_approx ( val,
int  len 
)

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

References abs(), d, isinf(), isnan(), len, max(), min(), n, round(), and x_nint().

Referenced by qStringValueFor().

◆ str2double()

OCTAVE_API Complex str2double ( const std::string &  str_arg)

◆ strcmp() [1/2]

template<typename T >
OCTAVE_API bool strcmp ( const T &  str_a,
const T &  str_b 
)

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. 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.

Referenced by mxArray_struct::get_field_number(), mxArray_base::is_class(), main(), mexGetVariable(), mexPutVariable(), octave_get_sig_number(), bp_table::parse_dbfunction_params(), and strcmp_ignore_n().

◆ strcmp() [2/2]

template<typename T >
OCTAVE_API bool 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.

◆ strcmpi() [1/2]

template<typename T >
OCTAVE_API bool 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.

Referenced by Fchol(), Feig(), Fjsondecode(), Fjsonencode(), Utils::fromHVAlign(), and strcmpi_ignore_n().

◆ strcmpi() [2/2]

template<typename T >
OCTAVE_API bool 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.

◆ strncmp() [1/2]

template<typename T >
OCTAVE_API 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.

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.

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

◆ strncmp() [2/2]

template<typename T >
OCTAVE_API 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.

◆ strncmpi() [1/2]

template<typename T >
OCTAVE_API 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.

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.

Referenced by Fstrncmpi(), and get_mapper_fun_options().

◆ strncmpi() [2/2]

template<typename T >
OCTAVE_API 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.

◆ u8_from_encoding()

OCTAVE_API std::string u8_from_encoding ( const std::string &  who,
const std::string &  native_string,
const std::string &  encoding 
)

◆ u8_to_encoding()

OCTAVE_API std::string u8_to_encoding ( const std::string &  who,
const std::string &  u8_string,
const std::string &  encoding 
)

◆ u8_validate()

OCTAVE_API unsigned int u8_validate ( const std::string &  who,
std::string &  in_string,
const u8_fallback_type  type = U8_REPLACEMENT_CHAR 
)

Referenced by F__u8_validate__().