Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern puzzle

Status
Not open for further replies.

digiduck

Programmer
Apr 4, 2003
95
US
In the following example #### represents any number of varying length.

Code:
{\cf11\super ####}

I need a way to run through a string like...

Code:
This is a {\cf11\super 87} number for you {\cf11\super 653}.

...and replace the {\cf11\super ####} with just the number where the #### is. The result of the above would then be...

Code:
This is a 87 number for you 653.

Any help would be greatly appreciated. Thank You.

Gone looking for myself. Should I arrive before I'm back, keep me here.
 
I should clarify that in the process of replacing each result I need to store the #### in a variable so I can't simple search for "{\cf11\super" and "}" and remove them.

Gone looking for myself. Should I arrive before I'm back, keep me here.
 
you could use
Code:
myString.LastIndexOf("{cf11\super")
to find the place in your sentence where the number starts, then find the index of "}" and pick up what's between it into a variable using
Code:
substring
...?
And then you would be able to replace "{\cf11\super" and "}" with an empty space

hope this helps and i'm not misunderstanding what you're trying to do!

 
you got it right thank you. The other way i found is to use RegularExpressions.

Thanks a bunch.

Gone looking for myself. Should I arrive before I'm back, keep me here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top