HPlogo System Debug Reference Manual > Chapter 10 System Debug Standard Functions

func ascc

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Coerces an expression into a string value.

Syntax



  ascc (value)

Formal Declaration



  ascc:str (value:any)

Parameters


value

An expression to be coerced. Its type can be anything except BOOL.

This function takes the internal bit pattern for value and treats it as a sequence of ASCII characters. The function value returned is a string made up of these characters, the length of which is determined by the natural size of value according to the following table:

Table 10-1 Length of Coerced Strings

Parameter Type String Length
U16, S162
U32, S32, SPTR4
S64, LONG class8
EADDR, SADDR12
STRParameter string length

Examples



   $nmdebug > = ascc(%100+%1)
   'A'
   $nmdebug > wl strlen (ascc(%100+%1))
   $2

The expression %100+%1 is evaluated and coerced into a string value. Since the parameter type is effectively U16, the string contains two characters, a NULL (0) followed by a capital "A".

   $nmdebug > var bell strdel(ascc(7),1,1)
   $nmdebug > wl bell
   <beep>

This example builds a single-character string and assigns the result to the variable named bell. The STRDEL function is used to delete the leading NULL character, which is returned in the two-character string returned by the function ASCC.

Limitations, Restrictions


none




func asc


func bin