Only allow certain characters to be entered in html textinput

You can change your input text as below: <input type=”text” pattern=”[a-zA-Z0-9!@#$%^*_|]{6,25}” /> So the code changes look like below: <form action=”#” method=”get”> User Name:<br /> <input type=”text” pattern=”[a-zA-Z0-9!@#$%^*_|]{6,25}” /><br /> Password:<br /> <input type=”password” /><br /> <input type=”submit” value=”Log In” /> </form> This will work without using JavaScript. pattern can be used instead. It is … Read more

Remove last character from string. Swift language

Swift 4.0 (also Swift 5.0) var str = “Hello, World” // “Hello, World” str.dropLast() // “Hello, Worl” (non-modifying) str // “Hello, World” String(str.dropLast()) // “Hello, Worl” str.remove(at: str.index(before: str.endIndex)) // “d” str // “Hello, Worl” (modifying) Swift 3.0 The APIs have gotten a bit more swifty, and as a result the Foundation extension has changed … Read more

Special Characters in FPDF with PHP

Figured this out by doing the following (pagesubtitle is the name of the text field in the form): $reportSubtitle = stripslashes($_POST[‘pagesubtitle’]); $reportSubtitle = iconv(‘UTF-8’, ‘windows-1252′, $reportSubtitle); Then print it out: $pdf->Write (6, $reportSubtitle); This will remove any unwanted slashes following apostrophes, as well as use the ‘iconv’ function to print special characters such as ™

Representing EOF in C code?

EOF is not a character (in most modern operating systems). It is simply a condition that applies to a file stream when the end of the stream is reached. The confusion arises because a user may signal EOF for console input by typing a special character (e.g Control-D in Unix, Linux, et al), but this … Read more