Converting characters to integers and back

Home
Introduction
Tips and Techniques
Projects
Libraries
Links

To convert a character to an integer value you can use the general Dylan conversion function called as(...).

When converting from a character to an integer the value of the integer returned is implementation defined. In Functional Developer and Gwydion Dylan it is the ASCII value of the character.

   // Converting from a character to an integer
   let integer-value = as(<integer>, 'A');

   // integer-value will be equal to 65.
   // Converting from an integer to a character.
   let character-value = as(<character>, 65);
  
   // character-value will be 'A'.

Copyright © 2000, Chris Double. All Rights Reserved.
All products and brand names are the registered trademarks or trademarks of their respective owners.