Click here to Skip to main content
15,747,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a string as follows.

"Today I want to Meet Mr.Tanter MicSHot"

In the above string bolded t is 7th occurance "t" char in the stirng.

Now Like that, How to Nth Occurance of a charecter in a string.

Please tell me.
Posted
Comments
Sergey Alexandrovich Kryukov 20-Jul-12 0:47am    
What did you try? what's the problem?
--SA
jagadeesh kumar adabala 28-Jul-12 6:02am    
I'm just tryng like i have a string like this below.....
"MSH|^~\&|MDTm|Demo|Transdyne|Demo|20120706184400.231-05:00||ORU^R01|20120706184400.231-05:00|P|2.3"

Now i need to find the string between 6th and 7th indexes of a letter "|".
i.e 20120706184400.231-05:00

i shound find the index of 6th and occurances of letter |, which i need to use in other case.
Sergey Alexandrovich Kryukov 28-Jul-12 23:52pm    
In other words, you did not try to write any code, right? Than it will not work this way. This is the simplest problem; what's the use if someone writes the code for you?
--SA

1 solution

This is the first Google search link - C#: Find Nth occurrence of a character in a string[^]

Learn using Google and it will save you a lot of time!
 
Share this answer
 

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