Remove a Character from String RSLogix 5000

dcooper33

Lifetime Supporting Member + Moderator
Join Date
Jun 2011
Location
Rogers, AR
Posts
717
Hey Guys,

I've got an array of strings in an L75 processor that take the shape of something like this:

MyString[01] = '012345.678'

I'm needing to pull the data minus the '.' character.

MyResult = '012345678'

It's always the 7th character in the string. And then keep the result as a string with any preceeding zeroes still included.
There's plenty of good examples in C, vb, java online of how to do this, but I haven't found any for RSLogix.

I was thinking a STOD then back to DTOS might work, but haven't tried that yet. Wanted to see if you guys had ever done anything similar.

Thanks,
Dustin

EDIT: Just bench-tested this, and see that STOD drops everything after the '.'
While a STOR tested on a '133993.001' yields '133993.0'.
Thought that might be a quick and easy way to do it, but looks like I'll have to stick to string manipulation...
 
Last edited:
o_O

đź“š

RTFM, anyone?
Lol well the DELETE string instruction does exactly it says...and exactly what I needed.
 
o_O

đź“š

RTFM, anyone?
Lol well the DELETE string instruction does exactly it says...and exactly what I needed.

Glad you got it sorted, only took you less than 13 minutes... sorry i wasn't waiting for your post, i'd have pointed you in the right direction, although i'd have taken longer to post a reply ;)
 
Glad you got it sorted, only took you less than 13 minutes... sorry i wasn't waiting for your post, i'd have pointed you in the right direction, although i'd have taken longer to post a reply ;)

I'm glad I got it working too, but a bit embarrassed that I asked a question when the answer had been staring me right in the face!
After farting around with this for a good half-hour and then posting my question, I got the brilliant idea to actually check the instruction toolbar under ASCII string lol. I so rarely use the toolbar anymore...

If I hadn't posted, then I probably wouldn't have stumbled across the answer, and would probably still be working on an AOI that does what the DELETE instruction is designed to do.

I guess I'll take a few minutes of embarrassment over a half-day of reinventing the wheel!
 
I'm trying to use the delete instruction to delete the last character in a string. I want it to act like a backspace button on a keyboard since the string is being typed in on an HMI. I can't seem to get it to delete the last character. Here's a picture of what I'm trying so far
https://m.imgur.com/gallery/a5xiBij

Edit: I'm not sure why I can't attach pictures, but basically in the DELETE instruction I have 1 for the qty value and in the start value I have "string.DATA[string.LEN]"
I tried subtracting 1 from the string Len and using that as the pointer but it didn't work either.
 
Last edited:

Similar Topics

Hi, When the HMI (KTP1200 basic) powers up, the user has to enter their credentials to log in. In the screenshot, ADMIN has already logged in...
Replies
3
Views
1,004
Hi I have removed at IO card from a 1734-AENTR Point IO, from a slot in the middle, and moved the remaining cards together. Now the Point IO...
Replies
3
Views
669
Hi all, My name is Firdaus. I am a teacher. And for the next semester I have to teach PLC to student. The problem is, I just move to this school...
Replies
6
Views
1,994
In RSLogix5000 I am attempting to create an add-on instruction called "SWAP" which simply swaps the values of two integer tags. Here is what the...
Replies
5
Views
1,963
Hello all, I have a project that I need to remove so I can restore a newer version on to the machine (win7). When I use the application manager...
Replies
1
Views
1,162
Back
Top Bottom