Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends

I Have String Like

Str1= i am a { } and i want to play { } i will score { };


now i want replace the brackets by inserting another sting in the exact position

after that string looks like

i am a {joe} and i want to play { FootBall } i will score { 5 golas };

this example

first i want to find how any brackets are there in a string after the i want to position the another string
Posted
Updated 11-May-15 2:54am
Comments
ZurdoDev 11-May-15 9:10am    
If you had numbers in the brackets, {0}, {1}, then this would be very very simple. Without numbers in the brackets you'll just have to manually parse it all. There's no magical bullet.

 
Share this answer
 
string msg = string.Format("I am {0} and I want to play {1}, I will socore {3}", var1, var2, var3);
 
Share this answer
 
v2
Comments
Sascha Lefèvre 11-May-15 9:13am    
Always take a second look after submitting your answer: There's a quote missing at the end of the format string :)
Count the occurrence of the string "{ }".
 
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