std::regex_traits::lookup_collatename
Da cppreference.com.
< cpp | regex | regex traits
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
template< class ForwardIt > string_type lookup_collatename( ForwardIt first, ForwardIt last ) const; |
||
Se la sequenza di caratteri
[first, last)
rappresenta il nome di un elemento valido di collazione del locale attualmente permeato, restituisce il nome di tale elemento di confronto. In caso contrario, restituisce una stringa vuota.Original:
If the character sequence
[first, last)
represents the name of a valid collating element in the currently imbued locale, returns the name of that collating element. Otherwise, returns an empty string.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Elementi di collazione sono i simboli che si trovano in espressioni regolari POSIX tra
[.
e .]
. Ad esempio, [.a.]
corrisponde al a
carattere nella versione locale inglese. [.tilde.]
corrisponde al ~
personaggio nella versione locale C pure. [.ch.]
corrisponde alla ch
digramma in locale ceco, ma genera std::regex_error con codice di errore std::regex_constants::error_collate nella maggior parte degli altri locali.Original:
Collating elements are the symbols found in POSIX regular expressions between
[.
and .]
. For example, [.a.]
matches the character a
in the C locale. [.tilde.]
matches the character ~
in the C locale as well. [.ch.]
matches the digraph ch
in Czech locale, but generates std::regex_error with error code std::regex_constants::error_collate in most other locales.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Parametri
first, last | - | una coppia di iteratori che determina la sequenza di caratteri che rappresenta un nome di elemento di confronto
Original: a pair of iterators which determines the sequence of characters that represents a collating element name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Type requirements | ||
-ForwardIt must meet the requirements of ForwardIterator .
|
[modifica] Valore di ritorno
La rappresentazione del elemento di collazione nominato come una stringa di caratteri.
Original:
The representation of the named collating element as a character string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Esempio
#include <iostream> #include <string> #include <regex> struct noisy_traits : std::regex_traits<char> { template< class Iter > string_type lookup_collatename( Iter first, Iter last ) const { string_type result = regex_traits::lookup_collatename(first, last); std::cout << "regex_traits<>::lookup_collatename(\"" << string_type(first, last) << "\") returns \"" << result << "\"\n"; return result; } }; int main() { std::string str = "z|}a"; // C locale collation order: x,y,z,{,|,},~ std::basic_regex<char, noisy_traits> re("[x-[.tilde.]]*a", std::regex::basic); std::cout << std::boolalpha << std::regex_match(str, re) << '\n'; }
Output:
regex_traits<>::lookup_collatename("tilde") returns "~" true