<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Converting each character to a string into ASCII</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/</id><updated>2024-11-11T11:39:45.650000Z</updated><subtitle>Recent posts to Converting each character to a string into ASCII</subtitle><entry><title>Converting each character to a string into ASCII</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/?limit=25#ad60" rel="alternate"/><published>2024-11-11T11:39:45.650000Z</published><updated>2024-11-11T11:39:45.650000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com12cc8097f4632617ee08bd188954e72d5825763b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;A standard string is actually a list of bytes that represent the ASCII code for each character.&lt;br/&gt;
The following part of code will give you the ASCII code of one of the characters in the string:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;byChar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sInput&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>Converting each character to a string into ASCII</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/?limit=25#7719" rel="alternate"/><published>2024-11-11T10:38:11.953000Z</published><updated>2024-11-11T10:38:11.953000Z</updated><author><name>bertcom</name><uri>https://forge.codesys.com/u/bertcom/</uri></author><id>https://forge.codesys.comb1f39e32f853cdaacf81294d8073771e4a21b679</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;@TimvH, Thank you, i think this way i can seperate the complete string to characters.&lt;/p&gt;
&lt;p&gt;Next part of the topic is converting the characters to an ASCII code. Is there an standerd function in Codesys for this?&lt;/p&gt;
&lt;p&gt;I alredy searched a few hours for it on the internet. no succes.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Converting each character to a string into ASCII</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/?limit=25#03f1" rel="alternate"/><published>2024-11-11T10:31:56.874000Z</published><updated>2024-11-11T10:31:56.874000Z</updated><author><name>ph0010421</name><uri>https://forge.codesys.com/u/ph0010421/</uri></author><id>https://forge.codesys.com2985da790636c234d50a97676befa3cc5cd9b4bf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;So the printer wants an ASCII conversion of the hex equivalent of ASCII characters??&lt;br/&gt;
They don't make it easy for us&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Converting each character to a string into ASCII</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/?limit=25#53a0" rel="alternate"/><published>2024-11-09T14:35:38.058000Z</published><updated>2024-11-09T14:35:38.058000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com0aeac64cd67e60f12138c2dd7f37d837c5d05d1b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Nice puzzle for a Saturday afternoon :-). Here my suggestion:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;sInput&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;STRING&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'R123'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;byChar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;BYTE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;sOutput&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;STRING&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;sOutput&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;LEN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;THEN&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;RETURN&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;span class="k"&gt;FOR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;TO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;LEN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;DO&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;byChar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sInput&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;sOutput&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sOutput&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TO_STRING&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;byChar&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="n"&gt;END_FOR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>Converting each character to a string into ASCII</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5bf5513fc6/?limit=25#f853" rel="alternate"/><published>2024-11-08T14:55:43.273000Z</published><updated>2024-11-08T14:55:43.273000Z</updated><author><name>bertcom</name><uri>https://forge.codesys.com/u/bertcom/</uri></author><id>https://forge.codesys.com848b4164dc1ea122ac0476a6f1b12daf53b8c9c5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Good afternoon,&lt;/p&gt;
&lt;p&gt;I have a project where i need to split a string and send it in ascii code to an Domino Printer.&lt;/p&gt;
&lt;p&gt;Concept: i get an String from an Zebra scanner looking like this : " R002043;5410761402862;Oil Plus 2C Comp.A - Gris Belge;1286193824;"&lt;/p&gt;
&lt;p&gt;To start is the ";" the seperator. i found some functions to delete the ";" in a string. this is okay but now i want to convert each digit in the string into ascii like this:&lt;/p&gt;
&lt;p&gt;R=82&lt;br/&gt;
0=48&lt;br/&gt;
0=48&lt;br/&gt;
2=50&lt;br/&gt;
0=48&lt;br/&gt;
...&lt;/p&gt;
&lt;p&gt;This because the printer wants to receive a string like this:&lt;/p&gt;
&lt;p&gt;&amp;lt;esc&amp;gt;OQ001TE 82 48 48 50 48 ...&amp;lt;eot&amp;gt;&amp;lt;/eot&amp;gt;&amp;lt;/esc&amp;gt;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Anyone who can help me with setting me on the right track with some advice?
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry></feed>