Solved

breaking strings in to sub strings  based on delimiters

Posted on 2009-04-06
5
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

751 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