1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
10 #include <rte_string_fns.h>
12 /* split string into tokens */
14 rte_strsplit(char *string, int stringlen,
15 char **tokens, int maxtokens, char delim)
18 int tokstart = 1; /* first token is right at start of string */
20 if (string == NULL || tokens == NULL)
23 for (i = 0; i < stringlen; i++) {
24 if (string[i] == '\0' || tok >= maxtokens)
28 tokens[tok++] = &string[i];
30 if (string[i] == delim) {