Board index » delphi » adding strings

adding strings

How can I add 2 strings??

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

thanks for your help.
                                patrick

 

Re:adding strings


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

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

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...

Sincerely,

Nicolai J?rgensen

Re:adding strings


In article <6jcjnv$g2...@news02.btx.dtag.de>,
  patrick.berg...@t-online.de (patrick bergner) wrote:

Quote

> 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 ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

Re:adding strings


Patrick,
  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!!
Dave
http://www.erols.com/dparsons

On 13 May 1998 17:02:55 GMT, patrick.berg...@t-online.de (patrick

Quote
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 http://www.inconresearch.com/eoi
   "Outlook 98: Think of it as email plus your smother"

Other Threads