GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GETFIELDS(3) FreeBSD Library Functions Manual GETFIELDS(3)

getfields, gettokens, tokenize - break a string into fields

#include <u.h>
#include <libc.h>

int getfields(char *str, char **args, int maxargs, int multiflag,
char *delims)

int gettokens(char *str, char **args, int maxargs, char *delims)

int tokenize(char *str, char **args, int maxargs)

Getfields places into the array args pointers to the first maxargs fields of the null terminated UTF string str. Delimiters between these fields are set to null.

Fields are substrings of str whose definition depends on the value of multiflag. If multiflag is zero, adjacent fields are separated by exactly one delimiter. For example

	getfields("#alice#bob##charles###", arg, 3, 0, "#");

yields three substrings: null-string , alice, and bob##charles###. If the multiflag argument is not zero, a field is a non-empty string of non-delimiters. For example
	getfields("#alice#bob##charles###", arg, 3, 1, "#");

yields the three substrings: alice, bob, and charles###.

Getfields returns the number of fields pointed to.

Gettokens is the same as getfields with multiflag non-zero, except that fields may be quoted using single quotes, in the manner of See for related quote-handling software.

Tokenize is gettokens with delims set to "\t\r\n ".

/src/lib9/tokenize.c

strtok in

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.