std::strcmp

Da cppreference.com.
< cpp‎ | string‎ | byte

 
 
Stringhe libreria
Null-stringhe terminate
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Byte stringhe
Multibyte stringhe
Stringhe larghe
Classi
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
Null-stringhe terminate byte
Funzioni
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Carattere manipolazione
Original:
Character manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Le conversioni in formati numerici
Original:
Conversions to numeric formats
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Della gestione delle stringhe
Original:
String manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strcpy
strncpy
strcat
strncat
strxfrm
String esame
Original:
String examination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Memoria manipolazione
Original:
Memory manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memchr
memcmp
memset
memcpy
memmove
Varie
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strerror
 
Elemento definito nell'header <cstring>
int strcmp(constchar*lhs, constchar*rhs );
Confronta due stringhe con terminazione null byte. Il confronto è fatto lessicografico.
Original:
Compares two null-terminated byte strings. The comparison is done lexicographically.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sia lhs e rhs dovrebbe puntare a stringhe valide.
Original:
Both lhs and rhs should point to valid strings.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

[modifica]Parametri

lhs, rhs -
puntatori alle stringhe con terminazione null byte da confrontare
Original:
pointers to the null-terminated byte strings to compare
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica]Valore di ritorno

Valore negativo se lhs è menorhs.
Original:
Negative value if lhs is less thanrhs.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
0 se lhs è pari arhs.
Original:
0 if lhs is equal torhs.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Valore positivo se lhs è superiorerhs.
Original:
Positive value if lhs is greater thanrhs.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica]Esempio

#include <vector>#include <cstring>#include <algorithm>#include <iostream>   int main(){std::vector<constchar*> cats {"Heathcliff", "Snagglepuss", "Hobbes", "Garfield"};std::sort(cats.begin(), cats.end(), [](constchar*strA, constchar*strB){return std::strcmp(strA, strB)<0;});   for(constchar*cat : cats){std::cout<< cat <<'\n';}}

Output:

Garfield Heathcliff Hobbes Snagglepuss

[modifica]Vedi anche

confronta una certa quantità di caratteri di due stringhe
Original:
compares a certain amount of characters of two strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione)[modifica]
mette a confronto due buffer
Original:
compares two buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione)[modifica]
confronta due stringhe in accordo con i parametri locali
Original:
compares two strings in accordance to the current locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione)[modifica]
C documentation for strcmp
close