0
ParseInt this Symbol
 <-- how to find the bit configuration for this symbol (even in a decimal or hexadecimal form)? or isn't it a char? I need to check if it is present in a string. Any suggestion for resolving this?
5 Respuestas
+ 4
https://code.sololearn.com/WYCTOysAGnLv/#html
Put this into the "Expression" input at the top: "".charCodeAt(0)
The value will be 65532 (*note), and the INTERNAL (IEEE-754) float representation (bits and hex) are shown in the middle boxes.
edit: Using parseInt (EXTERNAL representation) they're :
alert(parseInt("".charCodeAt(0)).toString(2)); // binary
alert(parseInt("".charCodeAt(0)).toString(16)); // hexadecimal
* Note, 0xfffc (65532) is the Unicode replacement character for encoding errors (it's corrupt).
ref: https://www.fileformat.info/info/unicode/char/fffc/index.htm
.
+ 3
Use codePointAt() method, which returns a non-negative integer Unicode code point value.
eg:
document.write(String.fromCodePoint(65532, 9731, 9733, 9842, 0x2F804));
// expected output: "☃★♲你"
document.write("<br><br>");
var icons = '☃★♲';
document.write(icons.codePointAt(0));
// expected output: "65532"
+ 2
Incrible code, Kirk Schafer!
Suraj, that is what I was looking for!
thank you 2!!!
+ 2
my brain exploded looking at that
+ 1
[note] Edited to clarify internal vs external representation of IEEE-754 floats after reviewing what was desired.
Daniel Bandeira Just FYI, the "Best Answer" checkmark for Suraj's answer will help sort it first + my 'informational' answer below it + send some additional XP their way :)