Board index » delphi » adding strings

adding strings

How can I add 2 strings??

str3 := str1+str2;   doesn't work.

thanks for your help.


Re:adding strings

> str3 := str1+str2;   doesn't work.

This code should work just find if you want to add strings like this:
        s1, s2, s3: string;
        s2 := 'string2';
        s3 := 'string3';
        s1 := s2 + s3; // s3 = 'string2string3'

If you want to add the numeric value of two strings then convert them to
integers first with IntToStr() - if you need a decimal value then check
out the Val() method...


Nicolai J?rgensen

Re:adding strings

In article <6jcjnv$>, (patrick bergner) wrote:


> How can I add 2 strings??

> str3 := str1+str2;   doesn't work.

       Yes it does. Give us an _example_ where it doesn't - youmust be doing
something else wrong.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----   Now offering spam-free web-based newsreading

Re:adding strings

  That should work for you. Just a few thoughts: First off, are you
sure that you are in fact dealing with strings and not Pchar or
Ansistrings? Secondly, if you are working in Delphi 1, you will not be
able to add concatonate two strings to something longer than 255
characters. Just a thought.
       Good luck!!

On 13 May 1998 17:02:55 GMT, (patrick

bergner) wrote:

>How can I add 2 strings??

>str3 := str1+str2;   doesn't work.

>thanks for your help.
>                                patrick

Re:adding strings

Do you mean concatenate (see the Concat func)
or add (as in '2' + '2')?

Grace + Peace | Peter N Roth | Engineering Objects Int'l
     Now shipping the CatapultEngine? for Delphi 3+
Visit our website at
   "Outlook 98: Think of it as email plus your smother"

Other Threads