|
| String () |
| Crée une chaîne nulle.
|
|
| String (const char *str) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (char *str) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (const char *str, bool do_alloc) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (const char *str, Integer len) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (std::string_view str) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (StringView str) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (const std::string &str) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (const UCharConstArrayView &ustr) |
| Créé une chaîne à partir de str dans l'encodage UTF-16.
|
|
| String (const Span< const Byte > &ustr) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (StringImpl *impl) |
| Créé une chaîne à partir de str dans l'encodage UTF-8.
|
|
| String (const String &str) |
| Créé une chaîne à partir de str.
|
|
| String (String &&str) |
| Créé une chaîne à partir de str.
|
|
String & | operator= (const String &str) |
| Copie str dans cette instance.
|
|
String & | operator= (String &&str) |
| Copie str dans cette instance.
|
|
String & | operator= (StringView str) |
| Copie str dans cette instance.
|
|
String & | operator= (const char *str) |
| Référence str codé en UTF-8 dans cette instance.
|
|
String & | operator= (std::string_view str) |
| Copie str codé en UTF-8 dans cette instance.
|
|
String & | operator= (const std::string &str) |
| Copie str codé en UTF-8 dans cette instance.
|
|
| ~String () |
| Libère les ressources.
|
|
| operator StringView () const |
| Retourne une vue sur la chaîne actuelle.
|
|
ConstArrayView< UChar > | utf16 () const |
| Retourne la conversion de l'instance dans l'encodage UTF-16.
|
|
ByteConstArrayView | utf8 () const |
| Retourne la conversion de l'instance dans l'encodage UTF-8.
|
|
Span< const Byte > | bytes () const |
| Retourne la conversion de l'instance dans l'encodage UTF-8.
|
|
const char * | localstr () const |
| Retourne la conversion de l'instance dans l'encodage UTF-8.
|
|
std::string_view | toStdStringView () const |
| Retourne une vue de la STL sur la chaîne actuelle.
|
|
StringView | view () const |
| Retourne une vue sur la chaîne actuelle.
|
|
String | clone () const |
| Clone cette chaîne.
|
|
String | upper () const |
| Transforme tous les caractères de la chaîne en majuscules.
|
|
String | lower () const |
| Transforme tous les caractères de la chaîne en minuscules.
|
|
bool | null () const |
| Retourne true si la chaîne est nulle.
|
|
Integer | len () const |
| Retourne la longueur de la chaîne en 32 bits.
|
|
Int64 | length () const |
| Retourne la longueur de la chaîne.
|
|
bool | empty () const |
| Vrai si la chaîne est vide (nulle ou "")
|
|
Int32 | hashCode () const |
| Calcule une valeur de hashage pour cette chaîne de caractères.
|
|
void | writeBytes (std::ostream &o) const |
| Écrit la chaîne au format UTF-8 sur le flot o.
|
|
String | operator+ (const char *str) const |
| Retourne la concaténation de cette chaîne avec la chaîne str encodée en UTF-8.
|
|
String | operator+ (std::string_view str) const |
| Retourne la concaténation de cette chaîne avec la chaîne str encodée en UTF-8.
|
|
String | operator+ (const std::string &str) const |
| Retourne la concaténation de cette chaîne avec la chaîne str encodée en UTF-8.
|
|
String | operator+ (const String &str) const |
| Retourne la concaténation de cette chaîne avec la chaîne str.
|
|
String | operator+ (unsigned long v) const |
|
String | operator+ (unsigned int v) const |
|
String | operator+ (double v) const |
|
String | operator+ (long double v) const |
|
String | operator+ (int v) const |
|
String | operator+ (long v) const |
|
String | operator+ (unsigned long long v) const |
|
String | operator+ (long long v) const |
|
String | operator+ (const APReal &v) const |
|
bool | contains (const String &s) const |
| Indique si la chaîne contient s.
|
|
bool | startsWith (const String &s) const |
| Indique si la chaîne commence par les caractères de s.
|
|
bool | endsWith (const String &s) const |
| Indique si la chaîne se termine par les caractères de s.
|
|
String | substring (Int64 pos) const |
| Sous-chaîne commençant à la position pos.
|
|
String | substring (Int64 pos, Int64 len) const |
| Sous-chaîne commençant à la position pos et de longueur len.
|
|
template<typename StringContainer> |
void | split (StringContainer &str_array, char c) const |
| Découpe la chaîne suivant le caractère c.
|
|
void | internalDump (std::ostream &ostr) const |
| Affiche les infos internes de la classe.
|
|
|
static String | fromUtf8 (Span< const Byte > bytes) |
|
static String | replaceWhiteSpace (const String &rhs) |
| Effectue une normalisation des caractères espaces.
|
|
static String | collapseWhiteSpace (const String &rhs) |
| Effectue une normalisation des caractères espaces.
|
|
static String | fromNumber (unsigned long v) |
|
static String | fromNumber (unsigned int v) |
|
static String | fromNumber (double v) |
|
static String | fromNumber (double v, Integer nb_digit_after_point) |
|
static String | fromNumber (long double v) |
|
static String | fromNumber (int v) |
|
static String | fromNumber (long v) |
|
static String | fromNumber (unsigned long long v) |
|
static String | fromNumber (long long v) |
|
static String | fromNumber (const APReal &v) |
|
static String | format (const String &str) |
|
static String | format (const String &str, const StringFormatterArg &arg1) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6, const StringFormatterArg &arg7) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6, const StringFormatterArg &arg7, const StringFormatterArg &arg8) |
|
static String | format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6, const StringFormatterArg &arg7, const StringFormatterArg &arg8, const StringFormatterArg &arg9) |
|
static String | concat (const StringFormatterArg &arg1) |
|
static String | concat (const StringFormatterArg &arg1, const StringFormatterArg &arg2) |
|
static String | concat (const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3) |
|
static String | concat (const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4) |
|
static String | plural (const Integer n, const String &str, const bool with_number=true) |
| Forme standard du pluriel par ajout d'un 's'.
|
|
static String | plural (const Integer n, const String &str, const String &str2, const bool with_number=true) |
| Forme particulière du pluriel par variante.
|
|
static String | join (String delim, ConstArrayView< String > strs) |
|
|
class | StringBuilder |
|
class | StringUtilsImpl |
|
ARCCORE_BASE_EXPORT bool | operator< (const String &a, const String &b) |
|
ARCCORE_BASE_EXPORT bool | operator< (const String &a, const String &b) |
|
ARCCORE_BASE_EXPORT bool | operator== (const String &a, const String &b) |
| Compare deux chaînes unicode.
|
|
ARCCORE_BASE_EXPORT bool | operator== (const char *a, const String &b) |
| Compare deux chaînes unicode.
|
|
ARCCORE_BASE_EXPORT bool | operator== (const String &a, const char *b) |
| Compare deux chaînes unicode.
|
|
bool | operator!= (const String &a, const String &b) |
| Compare deux chaînes unicode.
|
|
bool | operator!= (const char *a, const String &b) |
| Compare deux chaînes unicode.
|
|
bool | operator!= (const String &a, const char *b) |
| Compare deux chaînes unicode.
|
|
ARCCORE_BASE_EXPORT std::ostream & | operator<< (std::ostream &o, const String &str) |
| Opérateur d'écriture d'une String.
|
|
ARCCORE_BASE_EXPORT std::istream & | operator>> (std::istream &o, String &str) |
| Opérateur de lecture d'une String.
|
|
ARCCORE_BASE_EXPORT String | operator+ (const char *a, const String &b) |
| Ajoute deux chaînes.
|
|
Chaîne de caractères unicode.
Cette classe permet de gérer une chaîne de caractères soit avec l'encodage UTF-8 soit avec l'encodage UTF-16. A noter que l'encodage UTF-16 est obsolète et sera supprimé dans une version ultérieure lorsque le C++20 sera disponible.
Toutes les méthodes utilisant des const char*
en arguments supposent que l'encodage utilisé est en UTF-8.
Les instances de cette classe sont immutables.
Cette classe est similaire à std::string mais avec les différences suivantes:
- la classe String utilise l'encodage UTF-8 alors que pour std::string l'encodage est indéfini.
- contrairement à std::string, il n'est pas possible actuellement de conserver des caractères nuls à l'intérieur d'une String.
- pour String, il y a une distinction entre la chaîne nulle et la chaîne vide. Le constructeur String::String() créé une chaîne nulle alors que String::String("") créé une chaîne vide. Si la chaîne est nulle, les appels à view() ou toStdStringView() retourne une chaîne vide.
Lorsque le C++20 sera disponible, la classe String correspondra au type std::optional<std::u8string>.
Pour des raisons de performance, pour construire par morceaux une chaîne de caractères, il est préférable d'utiliser la classe 'StringBuilder'.
Définition à la ligne 69 du fichier arccore/src/base/arccore/base/String.h.