<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to The cost of using STRING ?</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/44694e3c9f/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/44694e3c9f/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/44694e3c9f/</id><updated>2020-02-27T23:32:10.850000Z</updated><subtitle>Recent posts to The cost of using STRING ?</subtitle><entry><title>The cost of using STRING ?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/44694e3c9f/?limit=25#c74f" rel="alternate"/><published>2020-02-27T23:32:10.850000Z</published><updated>2020-02-27T23:32:10.850000Z</updated><author><name>HenryK</name><uri>https://forge.codesys.com/u/henryk/</uri></author><id>https://forge.codesys.com0b37ec2423a7a709bcf1ec566cbda47a56dad000</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, its a very old topic but still valid. I have a question regarding the statement &amp;gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
do not use the same string functions in different tasks&lt;/p&gt;
&lt;p&gt;I already found that recommendation or hint, that STRING functions from the standard library are not programmed to be reentrant.&lt;br/&gt;
Okay, usually its clear. But can you tell me why?&lt;br/&gt;
If I need STRING functions in POUs outsourced in libraries, do have to avoid the usage oif the functions from this Standard lib!?&lt;br/&gt;
Which should I use else?&lt;/p&gt;
&lt;p&gt;Thank you for your support.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>The cost of using STRING ?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/44694e3c9f/?limit=25#8283" rel="alternate"/><published>2020-02-27T23:32:06.224000Z</published><updated>2020-02-27T23:32:06.224000Z</updated><author><name>Igor Petrov</name><uri>https://forge.codesys.com/u/igor-petrov/</uri></author><id>https://forge.codesys.combe475208bb85e70e47cc44607c1ab7bcbafc181c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You are right. &lt;strong&gt;':='&lt;/strong&gt; is a full character by character copy. (Certainly you may get a pointer to string see. &lt;strong&gt;ADR &lt;/strong&gt;operator). Moreover you can use '=','&amp;gt;','&amp;lt;' in ST (but not '+', use &lt;strong&gt;CONCAT&lt;/strong&gt; function). For example:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: blue;"&gt;IF&lt;/span&gt; s2 = 'Shutten' &lt;span style="color: blue;"&gt;THEN&lt;/span&gt;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;CONCAT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Hello Mr.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;span style="color: blue;"&gt;END_IF&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I advice you to use string functions from (&lt;strong&gt;LEN&lt;/strong&gt;, &lt;strong&gt;LEFT&lt;/strong&gt;, &lt;strong&gt;FIND &lt;/strong&gt;etc. see 'String functions' in the manual) instead SysLibs…. (platform dependent).&lt;/p&gt;
&lt;p&gt;One limitation: do not use the same string functions in different tasks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>The cost of using STRING ?</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/44694e3c9f/?limit=25#50f1" rel="alternate"/><published>2020-02-27T23:32:04.565000Z</published><updated>2020-02-27T23:32:04.565000Z</updated><author><name>shutten</name><uri>https://forge.codesys.com/u/shutten/</uri></author><id>https://forge.codesys.com3b22e626bd5d996919c008224e1af4037ea81d76</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I'm new to IEC 61131-3 programming. Could someone clarify what the assignment operator (":=") in ST does when working with strings.&lt;/p&gt;
&lt;p&gt;E.g. myString := originalString;&lt;/p&gt;
&lt;p&gt;I was assuming this does a full character by character copy of the string, but I know in some lanuages only a reference pointer is copied. Now I wonder if my assumption is incorrect since there is string copy function in the system string library - SysStrCpy() in SysLibStr.lib.&lt;/p&gt;
&lt;p&gt;I've had some strange bugs happening ever since I started using strings and SFC (SFCCurrentStep in particular) and want to make sure I am using strings correctly.&lt;/p&gt;
&lt;p&gt;Any feeback on STRING usage is appreciated.&lt;/p&gt;
&lt;p&gt;Sebastian Hutten&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>