views:

58

answers:

3

I am constructing a URL and I have

escape($('#count_of_stations').html()

The problem is the value will come in like this

1 station
2 stations

I need to strip everything other then the first character, so is there a way to sent it with the " station(s)"?

A: 

if the wording is consistent, i'd just use a replace.

$('#count_of_stations').text($('#count_of_stations').text().relace('station', 'stations'));

Martin Ongtangco
+1  A: 

Would using substring work?

escape($('#count_of_stations').html().substring(0, 1));
Kelsey
+3  A: 
parseInt($('#count_of_stations').html())

It will discard the later non-numeric characters.

Matthew Flaschen
+1 even though the PO didn't explicitly say it, i am guessing he wants the number value.
jessegavin