![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]()
|
New Here? Please read this important info!!!
![]() |
#1 |
Member
![]() ![]() Join Date: Dec 2007
Location: Los Alamos
Posts: 239
|
AOI for string.replace method
I am looking for an AOI that can do string.replace(sSearch,sReplace).
Thanks. |
![]() |
![]() |
#2 |
Lifetime Supporting Member
![]() ![]() Join Date: Jun 2012
Location: Australia
Posts: 2,777
|
I'd imagine it would be pretty easy to put together with a few COP, FIND, DELETE and CONCAT instructions. I've never actually built one though.
|
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Dec 2007
Location: Los Alamos
Posts: 239
|
Shocking! PLC programmers probably not aware of this useful function in .NET.
I ended up w/: FIND, GRT, DELETE, INSERT |
![]() |
![]() |
#4 |
Lifetime Supporting Member
![]() ![]() Join Date: Jun 2012
Location: Australia
Posts: 2,777
|
Ah, I didn't even think of insert, that'd make it even easier!
PLC's are generally not geared toward string handling at all. They can do it, but it's never been a focus, because why would you do string handling in a PLC when you could do it in the HMI/OIT/software? You'd need a HMI/OIT/etc to allow for string manipulation in the first place, so it makes sense to do it at that level. I'm curious now - I can't think of any likely reason to need a string search-and-replace function within a PLC - what's your application? |
![]() |
![]() |
#5 |
Member
![]() ![]() Join Date: Oct 2005
Location: Brisbane
Posts: 313
|
I use an AOI with this in it:
if WorkString.LEN>0 and SearchString.LEN>0 then Find(WorkString,SearchString,1,FoundPos); if FoundPos>0 then Delete(WorkString,SearchString.LEN,FoundPos,WorkSt ring); Insert(WorkString,ReplaceString,FoundPos,WorkStrin g); end_if; end_if; |
![]() |
![]() |
#6 | |
Member
![]() ![]() Join Date: Dec 2007
Location: Los Alamos
Posts: 239
|
Quote:
Zebra Printing - further info here: https://www.advancedhmi.com/forum/in...8&topic=2209.0 |
|
![]() |
![]() |
#7 |
Lifetime Supporting Member
![]() ![]() Join Date: Jun 2012
Location: Australia
Posts: 2,777
|
So why not do the find and replace using VBA in the AAHMI before it even gets to the PLC/printer?
|
![]() |
![]() |
#8 |
Member
![]() ![]() Join Date: Dec 2007
Location: Los Alamos
Posts: 239
|
|
![]() |
![]() |
#9 |
Lifetime Supporting Member
![]() ![]() Join Date: Jun 2012
Location: Australia
Posts: 2,777
|
Right, got it. In that case, I'd probably build the ZPL string up piece by piece using CONCAT instructions, instead of starting with a complete string with placeholders and replacing them. But there are plenty of ways to skin this zebra.
|
![]() |
![]() |
Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting up a MSG in an AOI | pierrer | LIVE PLC Questions And Answers | 7 | November 22nd, 2018 04:37 PM |
Editing AOI's in RS LOGIX 5000 | dalcoleman | LIVE PLC Questions And Answers | 6 | July 25th, 2018 02:22 AM |
Programming Exercise: Sorting Algorithm w/Dynamic AOI – Results | Paully's5.0 | LIVE PLC Questions And Answers | 19 | January 29th, 2017 05:32 PM |
AB AOI design Inputs, Outputs, or InOuts? | abishur | LIVE PLC Questions And Answers | 5 | November 16th, 2016 09:55 AM |
WallClock and AOI Method | remullis | LIVE PLC Questions And Answers | 12 | January 30th, 2015 05:05 PM |