V+ Language Reference Guide, v17.x


ASC real-valued function

Syntax

ASC (string, index)

Function

Return an ASCII character value from within a string.

Parameters

string

String expression from which the character is to be picked. If the string is empty, the function returns the value -1.

index

Optional real-valued expression defining the character position of interest. The first character of the string is selected if the index is omitted or has a value of 0 or 1.

If the value of the index is negative, or greater than the length of the string, the function returns the value -1.

Details

The ASCII value of the selected character is returned as a real value.

Examples

;Returns the ASCII value of the letter "a".
                
    ASC("sample", 2)
    
;Returns the ASCII value of the first character of the
;string contained in the variable $name.

    ASC($name)
    
;Uses the value of the real variable "i" as an index to 
;the character of interest in the string contained in the
;variable "$system".

    ASC($system, i)
    

Related Keywords

$CHR string function

VAL real-valued function


Submit comments to: techpubs@adept.com
Last modified on: 3/27/2012
Copyright © 1994 - 2012. Adept Technology, Inc.