MathGroup Archive 2000

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

Search the Archive

Re: working with large strings.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21649] Re: working with large strings.
  • From: Harald Giese <giese at dkrz.de>
  • Date: Fri, 21 Jan 2000 03:59:58 -0500 (EST)
  • Organization: Institut fuer Meereskunde, Universitaet Hamburg
  • References: <86156m$jsj@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?


Hi Dustin,

Instead of using strings replace them by lists of characters (see Chap.
2.7.4 in "The Book").

-Harald


--- This message was entirely written using recycled electrons ---

Harald Giese
Email: giese at dkrz.de
Phone: +49 (0)40 42838 5796; Fax: +49 (0)40 5605724
Institut fuer Meereskunde der Universitaet Hamburg
(Institute of Oceanography of the University of Hamburg)
Troplowitzstrasse 7, D-22529 Hamburg


  • Prev by Date: Re: a question about complex variable
  • Next by Date: Re: working with large strings.
  • Previous by thread: Re: working with large strings.
  • Next by thread: Re: working with large strings.