Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference »

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

charToNum

the charToNum of char

Value returned: positive integer equal to the ASCII value of the char

Examples

the charToNum of "A"
charToNum("A")
put numToChar(charToNum("A")) = "A"

Demo Script

on nameUpperCase
ask "Please enter your name:"
if (it is empty) or (the result is "Cancel") then exit nameUpperCase
answer uppercase(it)
end nameUpperCase
function upperCase whatStr
repeat with charNum = 1 to the number of chars in whatStr
put charToNum(char charNum of whatStr) into thisChar
if thisChar ≥ 97 AND thisChar ≤ 122
then put numToChar(thisChar - 32) into char charNum of whatStr
end repeat
return whatStr
end upperCase

Related Topics

Placeholders

char

An expression that yields a single character.

For example:

"a"
return
tab
numToChar(13)

HyperTalk Reference


Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Modern View