Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coldfusion equivalent function of codePointAt

Tags:

coldfusion

In javascript there is a function codePointAt which returns A number representing the code point value of the character at the given index. Is there a UDF or built in function similar to codePointAt function?

var icons = '☃★♲';

console.log(icons.codePointAt(0));
// expected output: "9733"
like image 384
Vlad Avatar asked Mar 07 '26 05:03

Vlad


1 Answers

It's asc() in ColdFusion. The function only converts a single (the first) character though, so you have to extract the position of the desired character in a string by yourself, using mid() for example.

<cfscript>

    icons = '☃★♲';
    icon = mid(icons, 2, 1);

    writeOutput( asc(icon) );
    // expected output: "9733"

</cfscript>
like image 90
Alex Avatar answered Mar 10 '26 14:03

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!