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
 Extract numbers from text
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Thomas M

Germany
Posts

Posted - 07/08/2005 :  03:41:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5pro
Operating System: W 98

Hi everybody,

I have a problem with some files. In one row there is a code wich looks as follows:

xxxx_1_15
xxxxxx_1_17
xx_1_19

The "x" stands for different numbers, with different length and wich are not of any interst for me. The "_1_15" stands for 15. January and thats what I want to have.
So, does anybody has a suggestion how to turn:


xxxx_1_15 to 15.01.
xxxxxx_1_17 to 17.01
xx_1_19 to 19.01.

by a script, cause I dont want to do it by hand for more than 200 rows.

Mike Buess

USA
3037 Posts

Posted - 07/08/2005 :  06:58:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The problem is similar to finding the wks and column names of the dataset data1_B.

%A=xxx_1_15;
%A=%[%A,>'_']; // 1_15
%M=%[%A,'_']; // 1
if(%M<10) %M=0%M; // 01
%N=%[%A,>'_']; // 15
if(%N<10) %N=0%N;
%A=%N.%M; // 15.01
%A=;
15.01

...You can also use '_' as a token separator as follows.

%A=xxx_1_15;
%M=%[%A,#2,_]; // 2nd token (month)
if(%M<10) %M=0%M;
%N=%[%A,#3,_]; // 3rd token (day)
if(%N<10) %N=0%N;
%A=%N.%M;
%A=;
15.01

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/08/2005 09:38:09 AM
Go to Top of Page

Thomas M

Germany
Posts

Posted - 07/11/2005 :  06:55:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you! :)
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