MathGroup Archive 2002

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

Search the Archive

RE: LetterQ and DigitQ question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35977] RE: [mg35971] LetterQ and DigitQ question
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Sun, 11 Aug 2002 05:13:35 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

expr = "{1,2}";
And @@ (DigitQ /@ (ToString /@ (ToExpression@expr)))

True

That works if all the strings you'll apply it to are in that list
format.  If not, then something like this works...

expr1 = "{1,2,"; 
expr2 = "{1,2,m"; 
f[expr_] := (Intersection[#1, Characters["01234567890,{}"]] == 
     Union[#1] & )[Characters[expr]]
f[expr1]
f[expr2]

True

False

Bobby Treat

-----Original Message-----
From: Charles H. Dresser [mailto:dresserc at gouldacademy.org] 
To: mathgroup at smc.vnet.net
Subject: [mg35977] [mg35971] LetterQ and DigitQ question

Hello,
I have a problem with DigitQ and letterQ I would like for a string to
yeild True when run with DigitQ if the the string looks like this:
{1,2} 
and false if it looks like this:
{hello, there!!!}
Right now both strings return False because of "{ , }". So, if there
were anyway to include the charecters "{", "}", and "," into the
DigitQ "0-9" list temperarelly that would work, but I am sure there is
a better way to do that.   Thank You,
Charles


  • Prev by Date: Re: Corresponding function to given values...
  • Next by Date: Math 3.0 running but 4.0 little problem.
  • Previous by thread: Re: LetterQ and DigitQ question
  • Next by thread: Re: LetterQ and DigitQ question