/** * Copyright 2001-2013 Avocent Corporation. All rights reserved. * * @file LoginCheck.js * The file provides check routines for login purpose. */ /** * Checks whether the text contains only printable characters. * * @param strInput - the text to be validated. * * @return true - positive. * false - negative. * @note Printable characters are US-ASCII codes 33-126. */ function isPrintableASCII(strInput) { var iPrintableStart = 33; var iPrintableEnd = 126; if ((strInput == null) || (typeof strInput != "string")) { return (false); } var strText = new String(strInput); for (var i = 0; i < strText.length; i++) { if ((strText.charCodeAt(i) < iPrintableStart) || (strText.charCodeAt(i) > iPrintableEnd)) { return (false); } } return (true); }