Posted by : UTariq Wednesday, September 25, 2013



It is the process of dividing a string into sequences of contiguous characters separated by any of the characters that are part of delimiters.Basically tokenization word is derived from word "Token".
Token means a little part. For example if there is a string like that,

string st[]={"Programming Is Everything"};
Then if we divide a string into its parts like that 
Programming // This is called a Token
Is   // This is called a Token
Every thing   // This is called a Token
The function which is used for this is "Strtok(sentence, " ")"
Here a simple program which can help you to understand this.


Program:

#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
int main()
{
char arr[20]={"This is my book"};
char *ptr=arr;
ptr=strtok(arr, " "); // if there is a comma Between a sentence then we use a ","
cout<<ptr;
while(ptr!="Null")
{
ptr=strtok('\0', " ");
cout<<ptr<<endl;
}
getch();
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Let's Join Us

This blog is for Computer Programming Learner or who is interested in to learn different programming languages

Get Toolbar Free

Get our toolbar!

FeedBurner FeedCount

Computer Problems

Total Pageviews

Popular Post

Labels

About Us

I am a student Of computer Engineering , Studying at UET Taxila. Web development and Programming is my passion. http://about.me/umair.tariq

Top Commentators

Followers

Powered by Blogger.

Recent comments

- Copyright © Computer Problems -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -