Solved

breaking strings in to sub strings  based on delimiters

Posted on 2009-04-06
5
206 Views
Last Modified: 2012-05-06
Can any one suggest the best of breaking strings in to sub strings  based on delimiters?
is strtok is best way or is there any thing else whihc can do teh operation faster. i need to break a very long strings up to 100000 char long so need a very efficient way of it breaking it on "\n\r".
0
Comment
Question by:sramya
  • 4
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 24084454
The built in functions (such as strtok) should be very fast.  I doubt you could code your own function that would be faster.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 24084462
Don't forget - basic functions like that are used by the operating system and other low level code, a lot of time has gone into optimising their performance.
0
 

Author Comment

by:sramya
ID: 24084828
so you suggest that strtok is the best way to go...right?
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 24084943
yes
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 250 total points
ID: 24084965
Well, to be more accurate
If, for example, there would be a gap of at least 1000 chars between each token to split the string on then maybe you could get something fractionally faster (especially if you wrote some machine level code)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB Email Check 2 246
VC++ 6.0 issue 3 68
Help with FindIndex method; using predicate. 5 55
Need some help with Microsoft Visual Studio C++ 2003 5 51
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now