-
-
Notifications
You must be signed in to change notification settings - Fork 594
Tcl_script_is_latin_1
Paweł Salawa edited this page May 22, 2020
·
1 revision
Language: | Tcl |
---|---|
Plugin for language: | ScriptingTcl |
How to use: | Create custom SQL function. Suggested name: isLatin1 |
Function arguments | only 1, a string |
Function usage: | SELECT isLatin1('text to test against Latin-1') |
Description: | Iterates through character in the string, checking if it's a Latin-1 or not. If all characters are in Latin-1 range, returns 1. If at least one character is outside of the range, returns 0. |
binary scan [lindex $argv 0] c* codes
foreach code $codes {
# Fail if code is outside of ranges: 32-126, 160-256
if {$code < 32 || $code > 126 && $code < 160 || $code > 256} {
return 0
}
}
return 1