Ord

Top  Previous  Next

Prototype

 

intValue=Ord(strValue)

 

Description

 

Retrieve string ASCII code.

 

Parameters

 

strValue: string to convert

 

Returned Value

 

intValue: numeric value corresponding to character ASCII code.

Example

//It sets string to convert

StrInput:='TEST ASCII CONVERSION';

 

//It inizializes output variable

StrOutput:='';

 

for i:=1 to length(StrInput) do

begin

    //It takes a single character from string

    StrChar:=Copy(StrInput,i,1);

 

    //It converts the character

    IntInput:=Ord(StrChar);

 

    //It logs character converted

    ApplicationLog('The ASCII code of '+StrChar+' is: '+IntToHex(IntInput,2));

 

    //It links all code in a output string

    StrOutput:=StrOutput+IntToHex(IntInput,2);

end;

 

//It logs converted string

ApplicationLog('The output string is: '+StrOutput);