Solved

Help Variable's

Posted on 2001-07-18
11
121 Views
Last Modified: 2010-04-06
Example:
I have the following thing:
c1: = 'data';
c2: = 'data';
c3: = 'data';
c4: = 'data';
c5: = 'data';

that routine I can use to concatenate these fields within a for or while. s1: = s1 + c?

Greetings Ruben  
0
Comment
Question by:rbarzallo
  • 4
  • 2
  • 2
  • +2
11 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 10 total points
ID: 6295378
As in most other programming languages you cannot iterate over separate variables.

do something like

var
  C: array [1..5] of string;
  I: Integer;
  S: string;
begin
  C[1] := 'data1';
  C[2] := 'data2';
  C[3] := 'data3';
  C[4] := 'data4';
  C[5] := 'data5';
  S := '';
  for I := Low(C) to High(C) do
    S := S + C[I];
end;
0
 
LVL 4

Expert Comment

by:YodaMage
ID: 6295733
You have to use a pointer "^" in order to achieve this.
0
 

Author Comment

by:rbarzallo
ID: 6295976
ok,
entonces no puedo realizar como en visual basic :

  s1 := s1 + c&number


ruben
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rbarzallo
ID: 6295978
ok,
then I cannot make like in visual BASIC:
     s1: = s1 + c&number  

Ruben
0
 
LVL 4

Expert Comment

by:YodaMage
ID: 6295998
Nope
0
 

Author Comment

by:rbarzallo
ID: 6296043
by I complete,
c1: = 'data';

 Assuming this:
s2: = ' c1 ';
s1: = like knowing the content of c1 if this within s2??????  
Ruben
0
 

Author Comment

by:rbarzallo
ID: 6296047
that it means "nope"?  
 
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6296874
yodaMage, even using pointers may not york.
Nothing hinders the compiler to use a register for some of the variables.
0
 
LVL 2

Expert Comment

by:Felixin
ID: 6298209
Nope = no

Simplemente no puedes hacerlo porque el Delphi es un lenguaje estructurado que no esta pensado para eso. Lo que te plantean son alternativas: utilizar punteros, poner las variables en arrays.

Tanslation:

Nope=no (that was obvious ;-))

Simply you cannot make it because Delphi is a structurec languaje non thought for that. What they are giving to you are work arrounds: pointers, put the variables in arrays ...

Think that in Basic you can do many things that you can't in structured languajes. That's because you can mess up Basic code so easily if you're not very organized.

0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8703560
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept robert_marquardt's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question