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


Groups > comp.lang.javascript > #17282

Re: how to remove trailing decimal or decimal 0 of a string?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From BootNic <bootnic.bounce@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: how to remove trailing decimal or decimal 0 of a string?
Date Sat, 17 Nov 2012 11:28:26 -0500
Organization BootNic Party Make your vote count!
Lines 44
Message-ID <20121117112826.00530fe7@bootnic.server> (permalink)
References <e89247f7-aa7b-4c64-9de5-265ab78a5336@googlegroups.com>
Mime-Version 1.0
Content-Type multipart/signed; micalg=PGP-SHA1; boundary="Sig_/Oj3=O+lo6PZ3f_51mbC1afU"; protocol="application/pgp-signature"
X-Trace news.albasani.net l3RkRa28/b2szJqs9NZ3vLnGyl+QlPPOwnSFO7iqpPKDz7KRT8BEZkgokkaEEDK4fJVFV4LXkTtHiVZW8lKieA==
NNTP-Posting-Date Sat, 17 Nov 2012 16:28:26 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="aAMlU0TG0vSOwvu24J6darq2skXXGUIr2qweaB8sI2q2Y3XXlixAEyHl/sICJGAbLFNc80iS0pzV/sA/p+KP1j635/oRkXSNNv+X00opg4Uf35QpDsQLTGVtsDZSLioi"; mail-complaints-to="abuse@albasani.net"
User-Agent Claws Mail
X-Mailer Claws Mail
X-Newsreader Claws-Mail
face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAABhQTFRFAAAAACE A/97e562cvVpK5wAAznNS1r1CTn3nxwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA AHdElNRQfbAwEEGy452DVwAAAB1ElEQVQ4y1WUTZLjMAiFfRbjzAGErN5HUc3eEn2Adld6P0m1rj8P/ dlmE4evgIcEmuZiqyn2kTPH6pnqT/1HOed/6xmQWQX2F+BF5gDki1+ymrdmgMVIBa9nzm+6D8DUwC// 5Gy4A8vVLz8vhi5h34C/SU/FDmCzFTRJCt4Ab4kqbBqSagRqZIkQNg1JIin/7qjxFoGwaUgS8c+dnf8 IIhA2rV2SfHI1/eY0xS5J4gls67QdwB0gLhoROYjnkwUFiEArAuXU3OiuRiT96mAvYC0RkZJZkyd2xc /0bZYKFsGhRPIAjv+gr7iUVAA+KNBUjhRQjZgJzUYqeZiOiKSqFKghjB6thqgqTYUIF0+qcHrz2mrgF NPoAydgbk0VSJr5UTvHRW0KNBOzTdTPykOuAnbwf906ULmhNFgCzAXMpbhjtzMOZ6TCAVK9Jq0uR4Qk XABuk/d9ZysSRkQdEeYnUrVROoEIUTv3ycCdr22s0LfKbQBTQttSP4uNTHedxHCAUEGZRPK21HZ9dBB gFcxW7ymdMxnf9mO5gr4f2KjQQJPUN4rutg6ubZLMaWvjEXDaWixVGkAljZfBzgq+q6RwfUtcm+f58p bM61gDmy6AwqP3ca+e/27CGQClLJe3AAAAAElFTkSuQmCC
Content-Language en
X-Operating-System Linux wetBox 3.1.4.7.22
X-Face "b}DIfR1vz!3oiDs)txy9^EYii7~LSERS*Z,K;N1m!</`1lz);Jwg'a.H,=*"XW}&Tf{?\9jHz7g4!bQn}@f,:jie:KLE|SO=EXc$@-az._9!/C`0vb4!?BMH!O!.-y<Sm9*<?Bp|]/#,y*[|"Cf`yGl5&jI{;w(#kf'XQE8Rj#Y;@!`'GC[|nr$Qrp{',}PxM<!Ok?_^c>_5v~hPEqLdfbyrq-
Cancel-Lock sha1:ElpjvIccrUtIja50I39r5lytjwE=
Accept-Language en
Xref csiph.com comp.lang.javascript:17282

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

In article <e89247f7-aa7b-4c64-9de5-265ab78a5336@googlegroups.com>,
skrite <shawn@skrite.net> wrote:

> Javascript: Hey all, if myString = "11." i would like it to be just
> "11" if it is "11.0" i would also like it to just be "11" however, if
> the string ends with anything else, like "11.3" or "11.34" i would like
> to leave it the way it is. Basically, i want to remove the decimal
> point and trailing 0 of any of my strings that are whole numbers.

Perhaps convert the string to number:

myString = Number(myString);

if it needs to be a string:

myString = String(Number(myString));


-- 
BootNic                                               Sat Nov 17, 2012 11:28 am
  Our earth is degenerate in these latter days; bribery and corruption are
  common; children no longer obey their parents; and the end of the world is
  evidently approaching.
  *Assyrian clay tablet 2800 B.C.*

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


Thread

how to remove trailing decimal or decimal 0 of a string? skrite <shawn@skrite.net> - 2012-11-16 09:12 -0800
  Re: how to remove trailing decimal or decimal 0 of a string? Andrew Poulos <ap_prog@hotmail.com> - 2012-11-17 07:10 +1100
    Re: how to remove trailing decimal or decimal 0 of a string? Andrew Poulos <ap_prog@hotmail.com> - 2012-11-17 13:51 +1100
    Re: how to remove trailing decimal or decimal 0 of a string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-17 15:37 +0100
      Re: how to remove trailing decimal or decimal 0 of a string? Andrew Poulos <ap_prog@hotmail.com> - 2012-11-18 08:28 +1100
        Re: how to remove trailing decimal or decimal 0 of a string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-18 01:02 +0100
          Re: how to remove trailing decimal or decimal 0 of a string? Andrew Poulos <ap_prog@hotmail.com> - 2012-11-18 15:40 +1100
  Re: how to remove trailing decimal or decimal 0 of a string? Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-17 08:05 +0000
  Re: how to remove trailing decimal or decimal 0 of a string? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-11-17 09:24 +0100
    Re: how to remove trailing decimal or decimal 0 of a string? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-11-17 09:29 +0100
  Re: how to remove trailing decimal or decimal 0 of a string? Christoph Becker <cmbecker69@gmx.de> - 2012-11-17 12:04 +0100
  Re: how to remove trailing decimal or decimal 0 of a string? BootNic <bootnic.bounce@gmail.com> - 2012-11-17 11:28 -0500
    Re: how to remove trailing decimal or decimal 0 of a string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-18 01:56 +0100
      Re: how to remove trailing decimal or decimal 0 of a string? Dr J R Stockton <reply1247@merlyn.demon.co.uk.invalid> - 2012-11-19 19:53 +0000
        Re: how to remove trailing decimal or decimal 0 of a string? Andrew Poulos <ap_prog@hotmail.com> - 2012-11-20 11:03 +1100
          Re: how to remove trailing decimal or decimal 0 of a string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-20 01:50 +0100
          Re: how to remove trailing decimal or decimal 0 of a string? Dr J R Stockton <reply1247@merlyn.demon.co.uk.invalid> - 2012-11-21 18:44 +0000
            Re: how to remove trailing decimal or decimal 0 of a string? Andrew Poulos <ap_prog@hotmail.com> - 2012-11-22 14:07 +1100
        Re: how to remove trailing decimal or decimal 0 of a string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-20 01:04 +0100
          Re: how to remove trailing decimal or decimal 0 of a string? Dr J R Stockton <reply1247@merlyn.demon.co.uk.invalid> - 2012-11-21 19:00 +0000
      Re: how to remove trailing decimal or decimal 0 of a string? Christoph Becker <cmbecker69@gmx.de> - 2012-11-20 02:10 +0100
        Re: how to remove trailing decimal or decimal 0 of a string? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-20 21:58 +0100
        Re: how to remove trailing decimal or decimal 0 of a string? Dr J R Stockton <reply1247@merlyn.demon.co.uk.invalid> - 2012-11-21 19:09 +0000
  Re: how to remove trailing decimal or decimal 0 of a string? Dr J R Stockton <reply1246@merlyn.demon.co.uk.invalid> - 2012-11-17 21:08 +0000

csiph-web