Jump to content
Server Maintenance This Week. ×

char(number) not working as I expected...


This topic is 2869 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a Calculation field (in FMPro 12) that includes the following:

Char ( 21 ) & Char ( 22 ) & Char ( 97)

[note: Calculation result is set as "Text"]

I had expected the result of this calculation to be !"a

but instead it is 2 blank spaces and a

Can somebody explain why the result doesn't include ! and "

Link to comment
Share on other sites

17 minutes ago, philipcaplan said:

I had expected the result of this calculation to be !"a

Perhaps you think that the Char() function takes a hexadecimal number as its argument. It doesn't. The argument is a decimal number - so in order to get an exclamation mark, you need to use Char ( 33 ), and Char ( 34 ) for a quotation mark.

Strangely enough, you have used the correct Char ( 97 ) to get an "a" and not Char ( 61 ) as would be consistent with your logic.

BTW, the two characters you have received are not spaces, but control characters.

 

Link to comment
Share on other sites

This topic is 2869 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.