Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
StringTools[Char] - map a number to the corresponding character
StringTools[Ord] - map a character to its ASCII code point
Calling Sequence
Char( n )
Ord( s )
Parameters
n
-
integer in the range
s
Maple string
Description
The procedures Char and Ord provide a bijective mapping between the characters that may appear in Maple strings and the integers in the range via the (8-bit) ASCII character set. These procedures are similar to the homonymous operators in Pascal (and its descendents) and other languages in which characters are not an integer data type.
The Char(n) function, where n is an integer in the range , evaluates to the character (string of length one) whose ASCII code point is n. The number is also accepted and, in this case, the empty string is returned.
The Ord(s) function maps characters to their ASCII code points. As a special case, (in which the argument is the empty string) evaluates to . Given any nonempty string s, is equivalent to , which evaluates to the ASCII code point of the character .
Note the relations Char( Ord( s ) ) = s[ 1 ], for any nonempty string s, and Ord( Char( n ) ) = n, for any integer n in the range . Thus, Char and Ord are nearly mutual inverses.
These functions are part of the StringTools package, and so they can be used in the form Char(..) only after executing the command with(StringTools). However, they can always be accessed through the long form of the command by using the form StringTools[Char](..).
Examples
Error, (in StringTools:-Char) integer argument is too large
See Also
cat, convert, map, op, seq, string, StringTools, StringTools[Explode]
Download Help Document