Welcome to WebmasterWorld Guest from 54.163.115.193

Forum Moderators: open

Testing a string for a specific ASCII character code

   
11:36 pm on Apr 8, 2009 (gmt 0)

5+ Year Member



Hi,

I need to test an incoming string for the presence of ASCII 0298 within a specific word, p(0298)n.

I don't want to convert it and I won't know its position in the string, I just need to know if it's in the string.

Here's my first stab, but I know I'm missing something:
if (Title.indexOf('P'+chr(0298)+'n') == -1) {
do something...
}

I totally made up the chr() part for this example, but what's the correct javascript code for that concept? Is indexOf even workable in this situation?

Thanks,
Glenn

12:22 am on Apr 9, 2009 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



if 0298 is a unicode sequence (4 digit hex) then 'p\u0298n'
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month