MathGroup Archive 2004

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

Search the Archive

Re: Howto turn off using symbols to tag objects?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46601] Re: Howto turn off using symbols to tag objects?
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 25 Feb 2004 13:06:56 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <c1h0vu$9t5$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <c1h0vu$9t5$1 at smc.vnet.net>, mvdv at spamcop.net (mvyver) 
wrote:

> Hi, Does anyone know how to turn this feature off?
> The section in the documentation "Using symbols to tag objects" is
> silent.

I have no idea why you want to do this ...

> My problem is that when trying to remove alphabet characters from a
> string I'm told that "123k" is a number!!
> 
> NumberQ[ToExpression["123k"]]
> True

Really? I don't get this behaviour in Version 5.0:

   NumberQ[ToExpression["123k"]]
   False

If you look at the output of ToExpression["123k"] you will see that you 
get 123 k (since Mathematica expressions cannot start with numbers).

You say that your goal is to remove alphabet characters from a string -- 
so you probably should use String operations. For example,

  ReadList[StringToStream["123k"], {Number, String}]

or

  DeleteCases[ToExpression /@ Characters["123k"], _?NumberQ]

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: need favor
  • Next by Date: Re: PowerExpand
  • Previous by thread: Re: Howto turn off using symbols to tag objects?
  • Next by thread: a question about [[ ]]