Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: String substitution system

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97388] Re: String substitution system
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Thu, 12 Mar 2009 02:19:45 -0500 (EST)
  • References: <200903070738.CAA16935@smc.vnet.net> <gp081u$l3g$1@smc.vnet.net>

Sure:

In[188]:= StringReplace["ABCXCDBXCBDXXBD", "X" ~~ Y_ :> Y ~~ "Z"]

(note the :> instead of the ->)

Out[188]= "ABCCZDBCZBDXZBD"

Cheers -- Sjoerd

On Mar 11, 12:08 pm, Hauke Reddmann <fc3a... at uni-hamburg.de> wrote:
> THX for the answers. While I'm at it anyway,
> is it still that easy when I need substitution rules
> with placeholders? E.g. XY->YZ for fixed X,Z
> but any string Y?
>
> --
> Hauke Reddmann <:-EX8    fc3a... at uni-hamburg.de
> Nur Schufte schuften - Genie genie=DFt.



  • Prev by Date: How to rotate a Histogram (Mathamatica 6)
  • Next by Date: Flipping axes on Graphics
  • Previous by thread: Re: String substitution system
  • Next by thread: Re: String substitution system