MathGroup Archive 2005

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

Search the Archive

Re: Position different in 5.0 and 5.1?


The Help Browser indicates that there have been some changes in V. 5.1 
concerning StringTake and other related functions (q.v.). Under this 
circumstances, and since there is a funcion StringCases, which appears to be 
new in V. 5.1, the following achieves what you want:

In[1]:=
Position[StringCases[{"asd", "dsa"}, x_, 1],
  y_ /; y == {"a"}]

Out[1]=
{{1}}


Tomas Garza
Mexico City

>From: "J R Gog" <jrg20 at cam.ac.uk>
To: mathgroup at smc.vnet.net
>Reply-To: "J R Gog" <jrg20 at cam.ac.uk>
>Subject: [mg56091] [mg56057] Position different in 5.0 and 5.1?
>Date: Thu, 14 Apr 2005 08:55:35 -0400 (EDT)
>
>I've recently upgraded from 5.1 from 5.0 and have found that some of my old
>notebooks don't seem to work. I think I have the essence of what I'm 
>utterly
>confussed about in this example:
>Position[{"asd", "dsa"}, x_ /; (StringTake[x, 1] == "a")]
>
>What I want is the position of list entries which have first character "a".
>In 5.0, this line works. In 5.1, I get an error that StringTake is being 
>fed
>a string.
>
>I can't find any documentation that explains what has changed to have this
>effect. I'm sure I've missed something obvious, but if anyone can explain 
>to
>me what has changed, it would be very helpful indeed. I know I can do
>everything some other way, but I need to know exactly what old stuff I need
>to change!
>
>
>
>Thanks
>
>
>
>Julia Gog
>
>



  • Prev by Date: Re: Legendre Polynomials
  • Next by Date: Re: Position different in 5.0 and 5.1?
  • Previous by thread: Re: Position different in 5.0 and 5.1?
  • Next by thread: Re: Position different in 5.0 and 5.1?