Re: working with large strings.
- To: mathgroup at smc.vnet.net
- Subject: [mg21666] Re: [mg21615] working with large strings.
- From: "Mark Harder" <harderm at ucs.orst.edu>
- Date: Fri, 21 Jan 2000 04:00:19 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Dustin,
Have you tried StringReplacePart (online Help under Programming>String
Manipulation)? Eg.,
In[19]:= strng= "this is a string";
StringReplacePart[strng,"change",{-6,-1}]
Out[19]= "this is a change"
-mark
-----Original Message-----
From: dustin <dsoodak at virtu.sar.usf.edu>
To: mathgroup at smc.vnet.net
Subject: [mg21666] [mg21615] working with large strings.
>
>If you want to write a program that alters elements of very large lists
>you can alter single elements with
>
>largelist[[elementnumber]]=newvalue;
>
>However, if you want to do this with a large string you have to do
>something like
>
>largestring=StringTake[largestring,{1,elementnumber-1}]<>newvalue<>StringTa
ke[largestring,{1,elementnumber+1}];
>
>The problem with this is it requires making a whole new copy of the
>string to change just one element. This will really slow a program down
>if you are working with large strings or have to repeat the process many
>times.
>
>Does anyone know a way around this?
>
>Dustin Soodak
>
>