Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: Problems with Parsing !

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39574] Re: [mg39570] Problems with Parsing !
  • From: BobHanlon at aol.com
  • Date: Mon, 24 Feb 2003 03:10:44 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2/23/03 5:59:10 AM, frodo.biggins at gmx.net writes:


> I want to write a function with 2 arguments
> Example[base_Integer,numbers_]:=Module[{...}...]
> The function works fine except that numbers are Hex numbers starting with a
> 1 (eg. 1AB23)
> In this case Mathem. interprets the numbers as 1*AB23 and gives numbers as
> AB23 to the Module.
> Is there any way to prevent this (HoldForm[numbers] in the Module do not
> work!)
> 

One way is to just make the second argument a String.

example[base_Integer,numbers_String]:=Module[

       {n=ToExpression[ToString[base]<>"^^"<>numbers]},

       {n,BaseForm[n,base]}];



example[16,"1AB23"]



Bob Hanlon



  • Prev by Date: Re: Comment lines in different colour or font
  • Next by Date: Re: Display of legend in MultiListPlot
  • Previous by thread: Problems with Parsing !
  • Next by thread: MathKernel access Internet?