Re: working with large strings.
- To: mathgroup at smc.vnet.net
- Subject: [mg21644] Re: working with large strings.
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 21 Jan 2000 03:59:54 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <86156m$jsj@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
?Characters
"Characters[\"string\"] gives a list of the characters in a string."
Make a list of characters form your string, and finaly whe all
replacements
are done use StringJoin[] to recreate the string.
Hope that helps
Jens
dustin wrote:
>
> 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<>StringTake[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