Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
486 views
in Technique[技术] by (71.8m points)

split - C function for separate a string in array of chars

I want to create a function to split a text using a separator in C. Two parameters text and separator will be passed to the function and the function should return an array of chars.

For example if the string is Hello Word of C and the separator is a white space.

Then the function should return,

 0. Hello 
 1. Word  
 2. of 
 3. C

as an array of chars.

Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Does strtok not suit your needs ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...