Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
extract a number from a line of HTML file
Ak 756
8/13/2007 3:43:00 AM
Hi,
I have a line of HTML file like this
<td><B><font color=006689>123.20</font></B></td>
I want to remove all such HTML tags as '<xxx>' and only get the 123.20.
Would anyone kindly tell me how?
Thanks very much.
--
Posted via
http://www.ruby-...
.
2 Answers
Ak 756
8/13/2007 4:27:00 AM
0
Daniel ----- wrote:
> On 8/13/07, Ak 756 <macro.peng@gmail.com> wrote:
>>
>> Thanks very much.
>> --
>> Posted via
http://www.ruby-...
.
>
>
> Your going to need to give some more information here. Using
> javascript?
> On the server side? Is it always that format?
Hi Daniel
I got this line from the body of NET::HTTP.post_form. I want to extract
the digital number embedded in this line. Actually ,I think I can do
this by remove all strings begin with "<" and end with ">". But I don't
know how to do.
--
Posted via
http://www.ruby-...
.
Ak 756
8/13/2007 5:09:00 AM
0
Daniel ----- wrote:
> So server side... If you use the Hpricot Gem you can do this pretty
> easy.
>
> a = "<td><B><font color=006689>123.20</font></B></td>"
> value = Hpricot( a ).innerText.strip
>
> HTH
> Daniel
Hi Daniel
Thanks! Great gem! It's exactly what I want, and so simply!
Thanks very much.
ak756
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
extract a number from a line of HTML file
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password