       Re: position of letters in a string

• To: mathgroup at smc.vnet.net
• Subject: [mg53848] Re: [mg53803] position of letters in a string
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sat, 29 Jan 2005 06:03:02 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```UnsortedUnion[x_]:=
Module[{f},f[y_]:=
(f[y]=Sequence[];y);
f/@x]; (* From Further Examples for Union  *)

relPositions[str_String] :=
Module[{chars=UnsortedUnion[Characters[str]]},
ToExpression[#[] <> "=" <>
ToString[#[]]]& /@

lst={"catcatz","zrzttys"};

relPositions[lst[]];

{c,a,t,z}

{1,2,3,4}

relPositions[lst[]];

{z,r,t,y,s}

{1,2,3,4,5}

Bob Hanlon

>
> From: zak <chocolatez at gmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/01/28 Fri AM 02:43:47 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg53848] [mg53803] position of letters in a string
>
> in the list of strings:
> lst={"catcatz","zrzttys"}
> i want some procedure to give the letters in every string a number
> depending on its position and discarding the recurrent letters such
> that:
> first string: c=1;  a=2;  t=3; z=4
> second string: z=1;  r=2;  t=3;  y=4;  s=5
> zak
>
>

```

• Prev by Date: Re: position of letters in a string
• Next by Date: Re: random matrix from row and column sums
• Previous by thread: Re: position of letters in a string
• Next by thread: Nonlinear Curve Fitting