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
 All Forums
 Origin Forum
 Origin Forum
 Arguments in substring notation

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Jose Posted - 05/10/2000 : 8:38:00 PM
Some days ago I posted a new topic to the old server (www.microcal.com) that I can not find anywhere now, so I'll try to repeat it.

The documented use of the substring notation is as follows:

If I command

%a=John Smith;
type %[%a,"it"];

I get

John Sm

as "John Sm" is the part of the string %a that comes before the first occurrence of "it" substring.

But if I command


%a=John Smith;
%m="it";
type %[%a,%m];

I get nothing! This would be interesting if I want, for instance, to ask the user for the substring %m to look for, and in many other cases. But it seems impossible to me to get the desired result! Any idea?

jose.

4   L A T E S T    R E P L I E S    (Newest First)
Jose Posted - 05/25/2001 : 11:03:37 AM
Well, after thinking a little bit more, I've changed my IF condition into

if (asc(%[%a,ii:ii])==91)

as the ASCII for "[" is 91. And this works, so everything is alright.

j.

Jose Posted - 05/25/2001 : 07:59:34 AM
I have this file name:

%a=V(t) 2001-05-23 110731 [sample2].dat;


The following instruction works fine to find the position of the "]" character:

loop (ii,1,%[%a]) {if (%[%a,ii:ii]=="]") type $(ii);};

It returns 32.

But if I want to do the same with the "[" charater, it doesn't work!

It seems a conflict with closing brakets in instructions, but I don't know how to overcome it.

I've tried to changed double quotes with simple ones, and even using no quotes at all, but that also doesn't work.

I am using Origin 6.0 SR2.

Any alternative suggestion?

j.

greg Posted - 05/10/2000 : 12:42:00 PM
The argument to the substring notation can not be a string; it must be a literal.

You could write a script along the lines of:

%A=This is test text.;
%M=tes;
for(ii=1;ii<=%[%A]-%[%M]-1;ii++) {
if("%[%A,ii:$(ii+%[%M]-1)]"=="%M") {
type -a Found \x22%M\x22 in \x22%A\x22 at position $(ii);
}
};

to do what you propose.
Jose Posted - 05/10/2000 : 3:04:00 PM
Complicated, but it does what I want. Thank you very much!

jose.


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000