ASC statement

Purpose

Place an ASCII byte at the specified position in a string.

Syntax

ASC(string, position&) = byte_expression

Remarks

ASC places the ASCII code (0 to 255) of the specified character code byte_expression into string at position&.  The first character of the string is position one, followed by position two, etc.  If position& is negative, ASC counts from the end of the string.  For example, if position& is -2, the second to last character in string is modified.

See the ASC  function for more information on ASCII codes.

Restrictions

The ASC statement cannot be used to extend the length of a string.  If string is null (zero-length), or position is zero or greater than the length of string, the operation is ignored.

See also

ASC function, CHR$, MID$ statement

Example

A$ = "hello There"
ASC(A$,1) = 72 'replace 1st character with an "H"