This is a function normally found in the C language. However, it is useful to script developers as well and may be available in some implementations as an extension to the ECMA standard functionality.
This function tests to see if a character is printable. Unlike the isgraph() function, however it does include the space character in the set of valid characters that return true. It is likely that implementation provided versions of this will only support the lower 255 characters in the Unicode character set. Some may only support the lower 128 that correspond to the ASCII character set.
Functionally then, it is the result of testing for space and then cascading into the isgraph() test.
Strictly speaking, this function should be coded to be aware of locale specific issues. You may want to take the example simulation provided here and modify it to your own needs to support that. This is just a basic working example.
// Test for printable characters (only good up to char 127) function isPrint(aChar) { myCharCode = aChar.charCodeAt(0); if((myCharCode > 31) && (myCharCode < 127)) { return true; } return false; }
Prev | Home | Next |
isPlainHostName() | Up | isPunct() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |