獲取一個ASCII字符

出自 ArcoWiki
於 2018年6月7日 (四) 07:43 由 Slia (對話 | 貢獻) 所做的修訂 (创建页面,内容为“In order to '''get an ASCII character''' from a string it is necessary to use the command <code>CHR(num)</code>.<br/> It returns a string with the length of 1 ch…”)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
前往: 導覽搜尋

In order to get an ASCII character from a string it is necessary to use the command CHR(num).
It returns a string with the length of 1 char which contains the ASCII character corresponding to the numeric value of 'x' (1 to 255)

$$ Example to print ALL the ASCII characters

DECL/CHAR,50,st
DECL/INTGR,ii
DISPLY/OFF
DISPLY/TERM,V(TEXT)
DO/ii,1,255
$$ Assign to the (ii) value the corresponding ASCII character
st=ASSIGN/CHR(ii)
st=ASSIGN/CONCAT(STR(ii),' ',st)
TEXT/OUTFIL,st
ENDDO