Hi,
Awaken after long long sleep. To speed up things.
Testing this post to see if I can use iblogger for my post
Saturday, February 14, 2009
Sunday, November 27, 2005
My First Generosity - split function
Here My first try to put some useful VC++ code..
This is function which similar to VB Split command more or less of STRTOK with output as an array.
If need include this as I am using CString for an array out.
Function here follows.
output like:
Well hope you like this piece of code..
Regards
Abhay M
This is function which similar to VB Split command more or less of STRTOK with output as an array.
If need include this as I am using CString for an array out.
//#include <afx.h>
//#include <afxcmn.h>
Function here follows.
This function can be used with different delimiters, as an example here below:CString *split(CString str,char delimiter)
{
long len=0;
if(str.IsEmpty())
return NULL;
len=str.GetLength();
CString *st;
st=new CString[len];
int c=0;
while(1)
{
int pos=str.Find(delimiter);
if(pos!=-1)
{
st[c]=str.Left(pos);
str.Delete(0,pos+1);
}
else
{
st[c]=str;
break;
}
c++;
}
return st;
}
CString strFulltext = "Hello World this is Abhay Menon";
CString *strArry = split(strFulltext,' ');
output like:
strArray[0]="Hello"
strArray[1]="World"
strArray[2]="this"
strArray[3]="is"
strArray[4]="Abhay"
strArray[5]="Menon"
Well hope you like this piece of code..
Regards
Abhay M
About Myself
Hello All,
Am Abhay Menon from Delhi,India.
Am a computer freak since childhood. This has been my hobby.
Which now has turned to profession.
I present work for a company called RMSI.
Am Abhay Menon from Delhi,India.
Am a computer freak since childhood. This has been my hobby.
Which now has turned to profession.
I present work for a company called RMSI.
My domain of programming out here is into VC++ and ObjectARX.
Other than that also having been doing some coding in VC# and PL/SQL in Oracle 10.
Other than that also having been doing some coding in VC# and PL/SQL in Oracle 10.
More of the time I am always into this so most of my passtime is in and around the computer
like: Hardware tweaking, Listening to Music, Games (PC), and ofcourse learning something new.
I created this blog spot for a reason to share my idea and code which I make as generic function useful for fellow programmer and alike.
So just watch this spot for some interesting code which might be useful for someone or the other.
Regards
Abhay M
"if one dream should fall and break into a thousand pieces,
never be afraid to pick those pieces up and begin again"
Subscribe to:
Posts (Atom)