Linked Questions
77 questions linked to/from How to convert decimal to hexadecimal in JavaScript
5
votes
3
answers
37k
views
Int to hex string in javascript [duplicate]
I want to convert an number (integer) to a hex string
2 (0x02) to "\x02"
or
62 (0x0062) to "\x62"
How can I do that correctly?
1
vote
3
answers
7k
views
JQuery variable value in quotes [duplicate]
I have a problem putting variable value in quotes in Jquery:
for example:
I have a Html color code in variable color, which has a value #FFFF00. I vant to display variable value like this: "#FFFF00"....
4
votes
1
answer
3k
views
Equivalent of python's int('hex-string', 16) in Javascript? [duplicate]
Possible Duplicate:
How to convert decimal to hex in JavaScript?
Is there an equivalent of python's int('hex-string', 16) function in Javascript?
0
votes
2
answers
2k
views
I want to change base 10 number to base 16 [duplicate]
I'm writing some code(javascript) to change a base 10 number into base 16. I know base 16 have letters if the remainder is between 10 and 15. This is where I am having trouble. I can't change the ...
-2
votes
1
answer
1k
views
What is the source code of toString(16) in js? [duplicate]
I am keen to know the source code for .toString(16) in javascript Because I would like to check logic of how the dec code converted to hex code?
1
vote
1
answer
1k
views
How do I convert my HEX string into a number? [duplicate]
I wish to convert the whiteHex variable to a decimal using the parseInt() function, and store it in a variable, whiteDecimal.
var whiteHex = 'ffffff';
var whiteDecimal = parseInt(whiteHex);
I am ...
-2
votes
2
answers
778
views
Replace all `r, g, b` values with `hex` in JSON string [duplicate]
const jsonString = JSON.stringify(myJson, null, 2);
{
"object1": {
"subobject1": {
"r": 0,
"g": 0,
"b": 0
},
"someOtherProperty": 1
}...
1
vote
1
answer
436
views
How to Convert Double to Hexadecimal using javascript with 0x [duplicate]
I have a variable like this:
var currency = "4,990.17"
currency.replace(/[$,]+/g,"");
var currency2 = parseDouble(currency)-0.1;
How can I set currency2 to be hexadecimal with 0x ...
0
votes
1
answer
208
views
How to get a string representation of hex? [duplicate]
I tried this:
http://jsfiddle.net/CG8gx/1/
for(var i = 0x00; i <= 0x88; i++){
i = i.toString();
if (i.length === 1) {
i = "0" + i;
}
// console.log(i.length);
console....
1
vote
3
answers
96
views
I would like to change a string of numbers of length 54 characters from base 10 to base 16 in js or php [duplicate]
<?php
function base16($str){
$str = base_convert($str,10,16);
echo $str;
}
base16("000012345678920190113163721231000011101000000000100001");
//...
0
votes
0
answers
96
views
from a decimal to hexadecimal [duplicate]
Could someone help me
with this problem? from decimal to binary is already working, but I couldn't get it working from decimal to hexadecimal.
I have a problem with this code: var ant2 = som2 * (...
169
votes
9
answers
222k
views
How to convert binary string to decimal?
I want to convert binary string in to digit
E.g
var binary = "1101000" // code for 104
var digit = binary.toString(10); // Convert String or Digit (But it does not work !)
console.log(digit);
...
27
votes
10
answers
60k
views
How do I implement hex2bin()?
I need to communicate between Javascript and PHP (I use jQuery for AJAX), but the output of the PHP script may contain binary data. That's why I use bin2hex() and json_encode() on PHP side.
How do I ...
30
votes
10
answers
43k
views
Convert rgb strings to hex in Javascript
I am using the TweenMax JS library with the ColorPropsPlugin which will tween color values which are specified in many formats, the problem I have is that the result is always in the form of a string:
...
15
votes
6
answers
9k
views
get back a string representation from computeDigest(algorithm, value) byte[]
The Google App Script function computeDigest returns a byte array of the signature. How can I get the string representation of the digest?
I have already tried the bin2String() function.
function ...