Bibliothèque de chaînes C ++ - fin

La description

Il renvoie un itérateur pointant sur le premier caractère de la chaîne.

Déclaration

Voici la déclaration pour std :: string :: end.

iterator end();
const_iterator end() const;

C ++ 11

iterator end() noexcept;
const_iterator end() const noexcept;

Paramètres

aucun

Valeur de retour

Il renvoie un itérateur au-delà de la fin de la chaîne.

Des exceptions

Ne jetez jamais d'exceptions.

Exemple

Dans l'exemple ci-dessous pour std :: string :: end.

#include <iostream>
#include <string>

int main () {
   std::string str ("Tutorials Point");
   for ( std::string::iterator it=str.begin(); it!=str.end(); ++it)
      std::cout << *it;
   std::cout << '\n';

   return 0;
}

L'exemple de sortie devrait être comme ceci -

Tutorials point