<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/</id><updated>2024-07-24T09:56:06.948000Z</updated><subtitle>Recent posts to Array to String</subtitle><entry><title>Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/?limit=25#01c5" rel="alternate"/><published>2024-07-24T09:56:06.948000Z</published><updated>2024-07-24T09:56:06.948000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.comabb81b2397624b401397b986d1a1a15d5debd9a0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The string_Util_Intern is not the library I referred to.&lt;br/&gt;
With a CONCAT function (also with the string util library) a search is done for the NULL character.&lt;br/&gt;
If you concatenate 20000 characters to one string, then the longer the string, the longer it takes to find this NULL character.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/?limit=25#b98c" rel="alternate"/><published>2024-07-23T15:22:34.241000Z</published><updated>2024-07-23T15:22:34.241000Z</updated><author><name>mmpl</name><uri>https://forge.codesys.com/u/mmpl/</uri></author><id>https://forge.codesys.com35cd9cfd6c4481b126b8b68aa6156a0cee88f62f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Thank you for you reply. Yes I can concatenat longer string. I am using string_Util_Intern libraray for concat. The issue is abot plc performance. It takes 7 second. I am looking to improve time.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/?limit=25#f20a" rel="alternate"/><published>2024-07-22T14:08:00.050000Z</published><updated>2024-07-22T14:08:00.050000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com864178ede603b52ddda2538e9b0e6d9e3c117210</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The new (UTF8) string library is faster and can handle large strings.&lt;br/&gt;
&lt;a href="https://content.helpme-codesys.com/en/CODESYS%20String%20Libraries/_strlib_start_page.html" rel="nofollow"&gt;https://content.helpme-codesys.com/en/CODESYS%20String%20Libraries/_strlib_start_page.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PS, in CODESYS, the maximum string length is not 255 characters. The String functions of the standard library are limited to strings of 255 characters. But you can use other (memory) functions to handle strings larger than 255 characters.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/?limit=25#9d51" rel="alternate"/><published>2024-07-20T11:53:58.802000Z</published><updated>2024-07-20T11:53:58.802000Z</updated><author><name>peterned</name><uri>https://forge.codesys.com/u/peterned/</uri></author><id>https://forge.codesys.com25b9c9ca5df3764a2cea8d4187957d7c5717b440</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;max. string length in Codesys is 255 chars. It's not possible to cram 20,000 things in a string.&lt;br/&gt;
If you need to send the data to another device, send the whole data[] array (as byte array, without doing anything to it) and extract the information on the other end. As each struct member has a fixed size (81 bytes, as per you declaration), this will be easy.&lt;/p&gt;
&lt;p&gt;To save some resources, consider declaring string lengths - e.g. if the max possible length for key is 10 chars, declare it &lt;br/&gt;
key: STRING(10); and it will occupy 11 bytes instead of 81&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/?limit=25#3d13" rel="alternate"/><published>2024-07-19T20:11:38.946000Z</published><updated>2024-07-19T20:11:38.946000Z</updated><author><name>drml</name><uri>https://forge.codesys.com/u/drml/</uri></author><id>https://forge.codesys.comfcb0a9b5c391051b571c4b48647a2293cc04cbb4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If a size is not specified, CODESYS allocates 80 characters by default for a string. After 7 seconds, does your Json_string contain all of your 20000 key/values? Or is the result truncated to 80 characters?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Array to String</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2bb793ea26/?limit=25#ff4d" rel="alternate"/><published>2024-07-18T19:58:44.260000Z</published><updated>2024-07-18T19:58:44.260000Z</updated><author><name>mmpl</name><uri>https://forge.codesys.com/u/mmpl/</uri></author><id>https://forge.codesys.comf638dbe5b72c46c665205aa97dc605b31f56fd42</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I would like to create one large JSON string from an array of objects, where each object contains a value. My current approach involves using a for loop and string concatenation, but with 20,000 elements in the array, this method takes almost 7 seconds and negatively affects the PLC scan time.&lt;/p&gt;
&lt;p&gt;Is there a more efficient way to accomplish this?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>