Home All Groups Group Topic Archive Search About

How many times does a character appear



Author
9 Dec 2005 4:55 PM
Joey Martin
I've done this before but cannot remember how.

I have a field (FIELDNAME) in a sql2k environment.

I just need to know how many times an "_" appears in that field.

Pretty simple, but I cannot figure it out right now.

Thanks!


*** Sent via Developersdex http://www.developersdex.com ***

Author
9 Dec 2005 5:05 PM
Evertjan.
Joey Martin wrote on 09 dec 2005 in
microsoft.public.inetserver.asp.general:

> I've done this before but cannot remember how.
>
> I have a field (FIELDNAME) in a sql2k environment.
>
> I just need to know how many times an "_" appears in that field.
>
> Pretty simple, but I cannot figure it out right now.


ASP-js:

t = 'qwe_rtyq_uerty'
n = t.replace(/[^_]/g,'').length


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

AddThis Social Bookmark Button