Lingo Dictionary > L-N > numToChar()

 

numToChar()

Syntax

numToChar(integerExpression)

Description

Function; displays a string containing the single character whose ASCII number is the value of integerExpression. This function is useful for interpreting data from outside sources that are presented as numbers rather than as characters.

ASCII values up to 127 are standard on all computers. Values of 128 or greater refer to different characters on different computers.

Example

This statement displays in the Message window the character whose ASCII number is 65:

put numToChar(65)

The result is the letter A.

Example

This handler removes any nonalphabetic characters from any arbitrary string and returns only capital letters:

on ForceUppercase input
	output = EMPTY
	num = length(input)
	repeat with i = 1 to num
		theASCII = charToNum(input.char[i])
		if theASCII = min(max(96, theASCII), 123) then 
			theASCII = theASCII - 32
			if theASCII = min(max(63, theASCII), 91) then 
				put numToChar(theASCII) after output
			end if
		end if
	end repeat
	return output
end

See also

charToNum()