homepage Welcome to WebmasterWorld Guest from 54.166.84.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Testing a string for a specific ASCII character code
pillsbur

5+ Year Member



 
Msg#: 3888531 posted 11:36 pm on Apr 8, 2009 (gmt 0)

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

 

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3888531 posted 12:22 am on Apr 9, 2009 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved