The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Multi-lined text labels
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mike Buess

USA
3037 Posts

Posted - 07/05/2002 :  10:54:50 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
The normal method for accessing the nnth line of a string variable is

%A=%[%Z,@nn];

But that expression only works for nn<=100, evven though you can fill %Z with many more than 100 lines.

Example...

%Z=line 1;
loop (ii,2,200) {
%Z=%Z
line $(ii);
};
%Z=;
line 1
line 2
.
.
.
line 200

%A=%[%Z,@100];
%A=;
line 100
%A=%[%Z,@101];
%A=;
(no return value)

Is there another LabTalk or OriginC method for access the lines > 100?

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/05/2002 10:56:04

Edited by - Mike Buess on 07/05/2002 11:07:19

cpyang

USA
1406 Posts

Posted - 07/05/2002 :  1:07:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Best would be if we add a new method to string class to handle lines. For now, the following code will show how you can do this.


void tt()
{
GraphLayer gl = Project.ActiveLayer();
if(NULL==gl)
return;

GraphObject gr;
gr = gl.GraphObjects("Text");
if(NULL==gr)
return;

string str = gr.Text;
// assume text does not have '|' so
// can be used as separator
str.Replace("\r\n","|");
StringArray sa;
int nCount;
if((nCount = str.GetTokens(sa, '|')) > 0)
{
for(int ii = 0; ii < nCount; ii++)
out_str(sa[ii]);
}
return;
}




Edited by - cpyang on 07/05/2002 13:08:37
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/05/2002 :  2:00:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Good idea. Actually, I can probably just create %Z as one line with '|' separators in the first place.

Thanks,

Mike Buess
Origin WebRing Member
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000