Character codes: Difference between revisions
Content added Content deleted
(Added a solution for MATLAB) |
(added Go) |
||
Line 190: | Line 190: | ||
<lang fortran>WRITE(*,*) ACHAR(97), IACHAR("a") |
<lang fortran>WRITE(*,*) ACHAR(97), IACHAR("a") |
||
WRITE(*,*) CHAR(97), ICHAR("a")</lang> |
WRITE(*,*) CHAR(97), ICHAR("a")</lang> |
||
=={{header|Go}}== |
|||
In Go, a character literal ''is'' simply an integer constant of the character code: |
|||
<lang go>fmt.Println('a') // prints "97" |
|||
fmt.Println('π') // prints "960"</lang> |
|||
To print the character represented by a character code, we can create a string of that character (by converting the character code to string, it encodes the character in UTF-8): |
|||
<lang go>fmt.Println(string(97)) // prints "a" |
|||
fmt.Println(string(960)) // prints "π"</lang> |
|||
=={{header|Groovy}}== |
=={{header|Groovy}}== |