Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Testing a string for a specific ASCII character code



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

5+ Year Member


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?



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

WebmasterWorld Senior Member 10+ Year Member

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

Featured Threads

Hot Threads This Week

Hot Threads This Month