G.S
G.S

Reputation: 777

Convert character to ascii in Visual FoxPro 9.0 database

I have a value 'ABC' in my table and I want want to convert it into ASCII value.

How can this be done?

My output should be: 656667

Upvotes: 1

Views: 6102

Answers (1)

Jerry
Jerry

Reputation: 6557

Use the ASC() function. However, I believe it performs on 1 character at a time. So you'll have to loop through your string.

lcString = "ABC"
lcOutput = ""
FOR I = 1 TO LEN(lcString)
    lcOutput = lcOutput + ASC( SUBSTR(lcString, I, 1) )  &&Out puts the ascii value.
ENDFOR

Upvotes: 5

Related Questions