Click here to Skip to main content
15,888,080 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all, I have a c++ program which retrieves stock information in JSON format from yahoo finance for a given stock symbol, one of the fields has the last trade value embedded in a bold tag - anyone know a way of removing the tag ? I've googled and all the methods I've found seem to involve external libraries all of which are overkill for my needs ( the program is only for my amusement watching my shares go downhill following the referendum :-) ) The offending line is shown below

LastTradeWithTime: 4 : 00pm - "<b>699.21</b>"


What I have tried:

Googling and asking here for some assistance
Posted
Updated 5-Jul-16 20:35pm
v3

You could use a Regex:
Use
</?b>
As the match string, and use Regex.Replace to replace it with an empty string.
 
Share this answer
 
Comments
pkfox 5-Jul-16 5:40am    
Wouldn't that only catch the closing tag ?
OriginalGriff 5-Jul-16 5:47am    
No, the "?" says "zero or one" of the preceding character.
Get a copy of Expresso:

http://www.ultrapico.com/Expresso.htm

It's free, and it examines and generates Regular expressions.
pkfox 5-Jul-16 5:50am    
Ok cheers for that
pkfox 5-Jul-16 16:56pm    
How do you get tags to show in the message ?
OriginalGriff 5-Jul-16 17:19pm    
Edit it and you'll see - it's easier than trying to explain!
There's a "encode" option on the paste menu as well...
If you're sure the strings follow such a fixed format you may use string::substr (see string::substr - C++ Reference[^]) instead.
 
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