Path: csiph.com!news.swapon.de!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Decimal numeric string to hexadecimal numeric string? Date: Sat, 19 Jun 2021 11:42:16 +0100 Organization: A noiseless patient Spider Lines: 24 Message-ID: <87fsxegmpj.fsf@bsb.me.uk> References: <233183ba-98dc-47d5-84f6-bd3beef1e793n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="a7f27449a8e1d29c2e31ba58df9df84b"; logging-data="14269"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YnvjLc1q32RbpTc6mTebA4otW6oZpdnk=" Cancel-Lock: sha1:CvVI6cX7AOFUUgiXNsJ6IsqZtsc= sha1:2Qz+ZqV/BYI6l3EVPO6DuWyHT9w= X-BSB-Auth: 1.66ff9686bcac81ea8e81.20210619114216BST.87fsxegmpj.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:40233 Jonas Thörnvall 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.