EAGLE Help

strsplit()


Function
Splits a string into separate fields.

Syntax
int strsplit(string &array[], string s, char separator);

Returns
The strsplit function returns the number of entries copied into array.

Description
strsplit splits the string s at the given separator and stores the resulting fields in the array.

If separator is the newline character ("\n") the last field will be silently dropped if it is empty. This is done to have a text file that consists of N lines (each of which is terminated with a newline) and is read in with the fileread() function to be split into an array of N strings. With any other separator an empty field at the end of the string will count, so "a:b:c:" will result in 4 fields, the last of which is empty.

See also strjoin, lookup, fileread

Example

string a[];
int n = strsplit(a, "Field 1:Field 2:Field 3", ':');

Index Copyright © 2005 CadSoft Computer GmbH