XtScript Function: ord
Returns the numeric value of the given character.
ord is an XtScript function that will return the decimal value of a given character.
XtScript ord function basic syntax:
<!--parser:xtscript--> call ord $val=... <!--/parser:xtscript-->
Learn XtScript ord function from examples
Get the decimal value of a character using ord function.
- Code:<!--parser:xtscript--> # Assigning a space into a variable using chr so we can print space as the last character var $spa = call chr $val=32 var $char = D var $sym = ~ print Character $char has decimal value of$spa call ord $val=$char print <br/><br/> print The tilde symbol or "$sym" has decimal value of$spa call ord $val=$sym <!--/parser:xtscript-->- Result:
Character D has decimal value of 68
The tilde symbol or "~" has decimal value of 126
The tilde symbol or "~" has decimal value of 126
To see full all characters decimal value, you can view it in the ASCII Characters Entity Code.
Last edited on