Solved

breaking strings in to sub strings  based on delimiters

Posted on 2009-04-06
5
225 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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