MathGroup Archive 2002

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

Search the Archive

Re: Problems with ToString[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35963] Re: Problems with ToString[]
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Fri, 9 Aug 2002 05:18:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 8/8/02 at 6:06 AM, schmitther at netcologne.de (Hermann Schmitt) wrote:

>Hello, I have the following program:

>new[par___] := ( Print["The Parameters: ", par]; Print["The
>Parameters: ", ToString[par]]; ); new[2, 3, "Schmitt"]; and get the
>following result:
>
>The Parameters: 23Schmitt ToString ToString::nonopt: Options expected
>(instead of Schmitt) beyond position 2 in ToString[2, 3, Schmitt]. An
>option must be a rule or a list of rules.The Parameters: ToString[2,
>3, Schmitt] In[14]:=

>According to the Mathematica book no further parameters are necessary
>for ToString[].  Why does the system not like "Schmitt" as parameter?

You are passing all of the arguements as arguements to ToString. ToString expects the first arguement to be an expression to be converted to a string, the next arguement (when present) to be a format and the remaining arguements (when present) to be options. Since "Schmitt" isn't a rule or a list of rules you get the complaint.

If you want to convert the list of arguments to a single string, try the following
StringJoin@@(ToString/@{par})


  • Prev by Date: Re: ALL roots of non-polynomial equation
  • Next by Date: RE: ALL roots of non-polynomial equation
  • Previous by thread: Problems with ToString[]
  • Next by thread: RE: Problems with ToString[]