MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Avoid printing leading zero

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100772] Re: Avoid printing leading zero
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 13 Jun 2009 06:05:04 -0400 (EDT)

On 6/11/09 at 9:47 PM, lorenzana.jose at gmail.com (Jos=C3=A9 Lorenzana)
wrote:

>How do you avoid printing the leading zero in -0.03? I need to
>construct the string "-.03" .

>Something like this does not work:
>ToString at NumberForm[-0.3, {0, 2}]

Since you want a string result, it seems the most straight
forward way of doing this would be

In[13]:= StringReplace[ToString[-.03], "0." -> "."]

Out[13]= -.03



  • Prev by Date: Re: Avoid printing leading zero
  • Next by Date: Re: Avoid printing leading zero
  • Previous by thread: Re: Avoid printing leading zero
  • Next by thread: Re: Avoid printing leading zero