<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Need help parsing..]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I am not a C++ expert, so maybe someone on the Forum can help how to solve the Parse of the following</p>
<p dir="auto">@init dev:OF21 Av. John XXI uuid:d3f1c986-16b3-4758-9724-51da22471f0c</p>
<p dir="auto">How can I store the following characters in a variable1<br />
OF21 Av. John XXI</p>
<p dir="auto">as well as the following in a variable2<br />
d3f1c986-16b3-4758-9724-51da22471f0c</p>
<p dir="auto">Thanks<br />
Best regards</p>
]]></description><link>https://forum.gui-o.com/topic/117/need-help-parsing</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 16:13:23 GMT</lastBuildDate><atom:link href="https://forum.gui-o.com/topic/117.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Feb 2023 16:59:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Need help parsing.. on Mon, 27 Feb 2023 13:06:23 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/2">@gammda</a>,</p>
<p dir="auto">Thank you. For this project, this time i not use Bascom, i use ESP32 and Arduino.<br />
The code form Kl3m3n works fine.</p>
<p dir="auto">Best regards</p>
]]></description><link>https://forum.gui-o.com/post/501</link><guid isPermaLink="true">https://forum.gui-o.com/post/501</guid><dc:creator><![CDATA[Sato]]></dc:creator><pubDate>Mon, 27 Feb 2023 13:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 24 Feb 2023 21:40:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a><br />
If you use Bascom, this function (GetToken) is the best for parsing text.<br />
[<a href="https://www.mcselec.com/index2.php?option=com_forum&amp;Itemid=59&amp;page=viewtopic&amp;t=2543&amp;highlight=gettoken" rel="nofollow ugc">https://www.mcselec.com/index2.php?option=com_forum&amp;Itemid=59&amp;page=viewtopic&amp;t=2543&amp;highlight=gettoken</a></p>
]]></description><link>https://forum.gui-o.com/post/495</link><guid isPermaLink="true">https://forum.gui-o.com/post/495</guid><dc:creator><![CDATA[gammda]]></dc:creator><pubDate>Fri, 24 Feb 2023 21:40:45 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Sat, 18 Feb 2023 11:08:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/4">@kl3m3n</a>,</p>
<p dir="auto">OK, Thank you</p>
<p dir="auto">Regards</p>
]]></description><link>https://forum.gui-o.com/post/490</link><guid isPermaLink="true">https://forum.gui-o.com/post/490</guid><dc:creator><![CDATA[Sato]]></dc:creator><pubDate>Sat, 18 Feb 2023 11:08:56 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Sat, 18 Feb 2023 10:58:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a> said in <a href="/post/487">Need help parsing..</a>:</p>
<blockquote>
<p dir="auto">I will use it if you don't mind.</p>
</blockquote>
<p dir="auto">Of course you can use it, I don't mind.</p>
<p dir="auto">Best regards,<br />
kl3m3n</p>
]]></description><link>https://forum.gui-o.com/post/489</link><guid isPermaLink="true">https://forum.gui-o.com/post/489</guid><dc:creator><![CDATA[kl3m3n]]></dc:creator><pubDate>Sat, 18 Feb 2023 10:58:22 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 17 Feb 2023 20:22:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/4">@kl3m3n</a>,</p>
<p dir="auto">I still don't understand your code, but I will try to learn. Compared to (using indexOf(), etc...) your code is more elegant, I will use it if you don't mind.</p>
<p dir="auto">Your knowledge is impressive, you are still the best</p>
<p dir="auto">Thanks<br />
Regards</p>
]]></description><link>https://forum.gui-o.com/post/487</link><guid isPermaLink="true">https://forum.gui-o.com/post/487</guid><dc:creator><![CDATA[Sato]]></dc:creator><pubDate>Fri, 17 Feb 2023 20:22:39 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 17 Feb 2023 19:51:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a> Yes, because <strong>Serial.println</strong> requires String and not std::string...</p>
<p dir="auto">Try</p>
<pre><code>Serial.println(dev_str.c_str())
</code></pre>
<p dir="auto">kl3m3n</p>
]]></description><link>https://forum.gui-o.com/post/486</link><guid isPermaLink="true">https://forum.gui-o.com/post/486</guid><dc:creator><![CDATA[kl3m3n]]></dc:creator><pubDate>Fri, 17 Feb 2023 19:51:18 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 17 Feb 2023 19:32:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/4">@kl3m3n</a></p>
<p dir="auto">Yes, I use Arduino<br />
(using indexOf(), etc...):<br />
That's how I was doing it, but I wasn't sure that the uuid length was fixed.</p>
<p dir="auto">Your code compiles, but gives an error if you want to see the contents of dev_str and uuid_str in the serial monitor<br />
no matching function for call to 'HardwareSerial::println(const std::__cxx11::basic_string&lt;char&gt;&amp;)'</p>
<p dir="auto">Best regards</p>
]]></description><link>https://forum.gui-o.com/post/485</link><guid isPermaLink="true">https://forum.gui-o.com/post/485</guid><dc:creator><![CDATA[Sato]]></dc:creator><pubDate>Fri, 17 Feb 2023 19:32:40 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 17 Feb 2023 19:14:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a></p>
<p dir="auto"><strong>str</strong> is your <strong>msg</strong> <img src="https://forum.gui-o.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=29eca934c85" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">You using Arduino right?</p>
<p dir="auto">Try:</p>
<pre><code>std::string str = std::string(msg.c_str());
</code></pre>
<p dir="auto">and then use my code...</p>
<p dir="auto">Although it seems unnecessary to convert between String and std::string... You can write the same code using Arduino String functions (using indexOf(), etc...):</p>
<p dir="auto"><a href="https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/" rel="nofollow ugc">https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/</a></p>
<p dir="auto">Regards,<br />
kl3m3n</p>
]]></description><link>https://forum.gui-o.com/post/484</link><guid isPermaLink="true">https://forum.gui-o.com/post/484</guid><dc:creator><![CDATA[kl3m3n]]></dc:creator><pubDate>Fri, 17 Feb 2023 19:14:15 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 17 Feb 2023 19:08:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/4">@kl3m3n</a><br />
Thank you kl3m3n,</p>
<p dir="auto">Unfortunately I not undestand the code, but it gives compile error</p>
<p dir="auto">The @init dev:  OF21 Av. John XXI uuid:d3f1c986-16b3-4758-9724-51da22471f0c is in the msg variable</p>
<p dir="auto">I try<br />
auto dev_s = msg.find("dev:");<br />
auto uuid_s = msg.find("uuid:");<br />
compile error: const class String has no member named 'find'</p>
<p dir="auto">and that can't compile too<br />
auto dev_s = str.find("dev:");<br />
auto uuid_s = str.find("uuid:");<br />
compile error: 'str' was not declared in this scope</p>
<p dir="auto">NOTE: If you enable sending usr, this will not work as the usr payload is inserted between dev and uuid...<br />
I know, on startup don´t needed, later during the programm starting i get the usr</p>
<p dir="auto">Best regards</p>
]]></description><link>https://forum.gui-o.com/post/483</link><guid isPermaLink="true">https://forum.gui-o.com/post/483</guid><dc:creator><![CDATA[Sato]]></dc:creator><pubDate>Fri, 17 Feb 2023 19:08:41 GMT</pubDate></item><item><title><![CDATA[Reply to Need help parsing.. on Fri, 17 Feb 2023 18:42:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.gui-o.com/uid/8">@Sato</a> Hi.</p>
<p dir="auto">One option using STL:</p>
<pre><code>#include &lt;string&gt;

static const std::string dev_token{"dev:"};
static const std::string uuid_token{"uuid:"};
    
auto dev_s = str.find(dev_token);
auto uuid_s = str.find(uuid_token);
    
if(dev_s != std::string::npos 
   &amp;&amp; uuid_s != std::string::npos) {
     dev_s += dev_token.length();
     const auto dev_str = str.substr(dev_s, uuid_s - dev_s - 1); // -1 removes the trailing whitespace
        
     uuid_s += uuid_token.length();
     const auto uuid_str = str.substr(uuid_s, 36); // uuid is always 36 characters
        
     // dev_str and uuid_str are the desired payloads
}
</code></pre>
<p dir="auto"><strong>NOTE:</strong> If you enable sending <strong>usr</strong>, this will not work as the <strong>usr</strong> payload is inserted between <strong>dev</strong> and <strong>uuid</strong>...</p>
<p dir="auto">Best regards,<br />
kl3m3n</p>
]]></description><link>https://forum.gui-o.com/post/481</link><guid isPermaLink="true">https://forum.gui-o.com/post/481</guid><dc:creator><![CDATA[kl3m3n]]></dc:creator><pubDate>Fri, 17 Feb 2023 18:42:41 GMT</pubDate></item></channel></rss>