std::strtok
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <cstring>
|
||
char* strtok( char* str, const char* delim ); |
||
Sucht das nächste Token in einem Null-terminierte Byte String, auf den
str
. Die Trennzeichen werden durch nullterminierten byte String, auf den delim
identifiziert .Original:
Finds the next token in a null-terminated byte string pointed to by
str
. The separator characters are identified by null-terminated byte string pointed to by delim
.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.
Wenn str != NULL, durchsucht die Funktion für das erste Zeichen, das nicht Separator. Dieses Zeichen ist das Anfang der Token. Dann wird die Funktion sucht nach dem ersten Trennzeichen. Dieses Zeichen ist das Ende des Tokens. Funktion beendet und gibt NULL, wenn Ende
str
angetroffen wird, bevor Ende des Tokens gefunden wird. Andernfalls wird ein Zeiger auf Ende des Tokens in einer statischen Position zur nachfolgenden Aufrufen gespeichert. Dieses Zeichen wird dann durch ein NULL-Zeichen ersetzt und die Funktion gibt einen Zeiger auf die Anfang der Token .Original:
If str != NULL, the function searches for the first character which is not separator. This character is the beginning of the token. Then the function searches for the first separator character. This character is the end of the token. Function terminates and returns NULL if end of
str
is encountered before end of the token is found. Otherwise, a pointer to end of the token is saved in a static location for subsequent invocations. This character is then replaced by a NULL-character and the function returns a pointer to the beginning of the token.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.
Wenn str == NULL weiterhin die Funktion, von wo es nach links in vorherigen Aufruf. Das Verhalten ist das gleiche wie bei der zuvor gespeicherte Zeiger als str geleitet wird .
Original:
If str == NULL, the function continues from where it left in previous invocation. The behavior is the same as if the previously stored pointer is passed as str.
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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
str | - | Zeiger auf die null-terminierte Byte-String in Token aufzuteilen
Original: pointer to the null-terminated byte string to tokenize The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
delim | - | Zeiger auf die null-terminierte Byte-Zeichenfolge, die Trennzeichen
Original: pointer to the null-terminated byte string identifying delimiters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten] Rückgabewert
Zeiger auf den Beginn eines Token, wenn das Ende der Zeichenkette nicht angetroffen wurde. Ansonsten kehrt NULL .
Original:
Pointer to the beginning of a token if the end of string has not been encountered. Otherwise returns NULL.
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.
[Bearbeiten] Hinweis
Die Funktion ist nicht Thread-sicher .
Original:
The function is not thread safe.
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.
[Bearbeiten] Beispiel
Output:
A bird came down the walk
[Bearbeiten] Siehe auch
C documentation for strtok
|