FileMaker Custom Function: Hex to Decimal
This FileMaker Pro Custom Function converts a single character from hex to decimal.
I’m using it to convert an HTML-style hex colour into decimal, and then floating point values. I grab two characters from the string, pass each one to the function, and then divide the result by 30. The first two characters represent red, second two green, last two are the blue.
Function name: HexToDec
Function parameters: hexCharacter
Let (a = Upper ( Left(hexCharacter; 1) ); Case ( a = "0"; 0; a = "1"; 1; a = "2"; 2; a = "3"; 3; a = "4"; 4; a = "5"; 5; a = "6"; 6; a = "7"; 7; a = "8"; 8; a = "9"; 9; a = "A"; 10; a = "B"; 11; a = "C"; 12; a = "D"; 13; a = "E"; 14; a = "F"; 15;0) )