I have a string register "ARTICLE123.DT"
How can i remove ".DT" from the register in a program?
if it only 1234.DT its easy. But when there is letters that dosent work. Is karel the only option?
Only numbers:
R1=[SR10]
[SR10]=R1
I have a string register "ARTICLE123.DT"
How can i remove ".DT" from the register in a program?
if it only 1234.DT its easy. But when there is letters that dosent work. Is karel the only option?
Only numbers:
R1=[SR10]
[SR10]=R1
I think you need to resort to Karel. String logic is very capped in TPP...
How did the ".dat" end up in there in the first place?
Hi Lintan,
Where does the string come from? From a PC or from a PLC?
If this string or several strings have a similar structure, and are only inside your robot, you can assemble them yourself:
CALL SET_SR(2,'ARTICLE')
CALL SET_SR(3,1234)
CALL SET_SR(4,'.DT')
SR[1] = SR[2] + SR[3] + SR[4]
PROG SET_SR
SR[AR[1]]=AR[2]
Then it's quite easy to do something with a sub string...
Best
Display MoreHi Lintan,
Where does the string come from? From a PC or from a PLC?
If this string or several strings have a similar structure, and are only inside your robot, you can assemble them yourself:
CALL SET_SR(2,'ARTICLE')
CALL SET_SR(3,1234)
CALL SET_SR(4,'.DT')
SR[1] = SR[2] + SR[3] + SR[4]
PROG SET_SR
SR[AR[1]]=AR[2]
Then it's quite easy to do something with a sub string...
Best
The .DT file come from a foler on FR:/folder/ which contains saved Registry data.
I have a keral program that saves Register data to a file and the files name is for example articel.dt
i can load the data with a karel program to, but if i choose the file from a list in the HMI the .DT comes in the SR and then i cant load the program whit the karel program.
I only want this because the list from the HMI can work then.
I can manualy write the articelnumber and load.
It would be great with a Karel program that only deletes the .DT
USING TP:
You can search for the DOT(.) using FINDSTR.
Then using SUBSTR you can trunc the extension....
Display MoreTwo methods, based on PnsStarter's answer:
Method 1:
Assumes you're string always ends ".dt"
Method 2:
Set SR[s] = "."
Thank you, that worked