Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40233

Re: Decimal numeric string to hexadecimal numeric string?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Decimal numeric string to hexadecimal numeric string?
Date 2021-06-19 11:42 +0100
Organization A noiseless patient Spider
Message-ID <87fsxegmpj.fsf@bsb.me.uk> (permalink)
References <d210bffe-abab-448a-b36b-e1b27f3e25c0n@googlegroups.com> <233183ba-98dc-47d5-84f6-bd3beef1e793n@googlegroups.com> <db65730d-8ad2-478f-938b-b8398d62cdadn@googlegroups.com>

Show all headers | View raw


Jonas Thörnvall <jonas.thornvall@gmail.com> writes:

> fredag 18 juni 2021 kl. 14:59:24 UTC+2 skrev sc...@sauyet.com:
>> Jonas Thornvall wrote: 
>> 
>> > prgNbr="11" 
>> > 
>> > parseInt(prgNbr); 
>> > prgNbr.toInteger(16); 

>> What are you trying to do? 

> A numeric "decimal" string to hexdecimal string.
> So Michales suggestion did not work out, it gives a hexadecimal number
> not string.

  parseInt(prgNbr).toString(16)

Technically, parseInt(prgNbr, 16) doesn't give a hexadecimal number
(there is not such thing).  It gives a number by interpreting the string
as hexadecimal digits.

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Decimal numeric string to hexadecimal numeric string? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-17 14:28 -0700
  Re: Decimal numeric string to hexadecimal numeric string? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-06-17 21:38 -0700
    Re: Decimal numeric string to hexadecimal numeric string? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-19 00:39 -0700
  Re: Decimal numeric string to hexadecimal numeric string? Scott Sauyet <scott@sauyet.com> - 2021-06-18 05:59 -0700
    Re: Decimal numeric string to hexadecimal numeric string? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-19 00:45 -0700
      Re: Decimal numeric string to hexadecimal numeric string? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-19 11:42 +0100
        Re: Decimal numeric string to hexadecimal numeric string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 00:51 +0200
          Re: Decimal numeric string to hexadecimal numeric string? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-06-30 17:39 -0700
            Re: Decimal numeric string to hexadecimal numeric string? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-07-01 01:50 +0100
              Re: Decimal numeric string to hexadecimal numeric string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 12:46 +0200
            Re: Decimal numeric string to hexadecimal numeric string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 12:43 +0200

csiph-web