Modifying string length?_(re)

Thu, 1 May 1997 13:40:14 +0200 (MET DST)


According to The African Chief:
> 
> However, what  happens when you want to add a string to
> the end of it? Check this example, and look at the ouput
> under Borland;
> 
> program Fred;
> var
> s,s1:string[40];
> begin
>  s  := 'Fred Smith'+#0;
>  s1 := s + 'is okay'; 
>  writeln ( s1 ); 
> {prints "Fred Smith is okay" - where did the space before "okay" 
> come from? I didn't want or put it there - viz; problem with trailing "#0"}
> end.

It's no space; it's a #0, as you requested.

The above is an *explicit* trailing #0.  It is part of the string and
must not vanish when adding another string.

The *implicit* trailing #0 to be appended for CString compatibility
*will* vanish; however the program above will still produce the same
result.

    Peter

  Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
 maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es