Click here to Skip to main content
15,919,879 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to split a text line on basis of space characters without using split method in C sharp Console programming.
Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 9-Nov-11 11:22am    
I guess you have to explain what's wrong with Split.
--SA
Richard MacCutchan 9-Nov-11 11:29am    
Homework!
Sergey Alexandrovich Kryukov 9-Nov-11 14:55pm    
Probably. Does not look like a good assignment then. :-)
--SA
Babar_Malik 10-Nov-11 6:06am    
well it is not assignment,its a part of assignment.

Go through a loop checking each character in the string whether it is a space. Keep a log of all the indexes that are confirmed, and then use substring to split the string.

Hope this helps
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Nov-11 11:27am    
Aha, I guess this is an explanation of how Split works. It makes full sense only if OP explains why not Split (too much data, or what?), because if you put the results of all this in the array or a list of string, it won't be any better then Split. So, the question is what should be done with the results of this procedure. However, my 5 just for correct explanation of it.
--SA
You can use indexof function to find the index of space and split them using substring function
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Nov-11 14:56pm    
Also voted a 5 as this is an improved version of the solution by Wayne, with no redundant detail :-).
However, I would put the same comment as to the solution by Wayne...
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900