Converting integer to hex

Bonjour à tous !

Is there a change in hex conversion since 10.13?

This script returns “69” whereas we should get “FF”

use framework "Foundation"

set theHex to (current application's NSString's stringWithFormat_("%02x", "255")'s substringToIndex:2) as text

Anything other than %@ has been a crapshoot pretty much since forever. At one stage, other caused an instant silent crash. Some seem to work for a while, and then…

I’m going to replace this wonky objective C bridged method with some old good and solid vanilla AppleScript.
Thanks Shane. Have a nice day!