<?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[Operations with QString and int]]></title><description><![CDATA[<p dir="auto">I have written the following code to increase the last digit of the QString by 1</p>
<pre><code>QString myStr = "31415";
int myStr_sz = myStr.size();
int last_dig=myStr[myStr_sz-1].digitValue();
last_dig+=1;
debug()&lt;&lt;"New String is =" &lt;&lt;myStr;
</code></pre>
<p dir="auto">This has not modifed <code>myStr</code> . Can someone tell me where I am going wrong?</p>
<p dir="auto">Thanks in advance!</p>
]]></description><link>https://forum.qt.io/topic/134717/operations-with-qstring-and-int</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Jul 2026 02:40:43 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/134717.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Mar 2022 09:07:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 04:31:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704720">Operations with QString and int</a>:</p>
<p dir="auto">You are assigning ASCII value of 6 to the last character of string. Please refer to ASCII chart online. To simply answer your question, you can add '0' to ur last_dig. That should work.</p>
<pre><code> myStr[myStr_sz-1] = last_dig + '0'; 
</code></pre>
<p dir="auto">But why are u doing like this? What if the last digit is 9? When u add 1, you will need to add the second last digit as well. A better solution would be to completely convert the string to digit, do the arithmetric operation, and then convert it back to QString</p>
]]></description><link>https://forum.qt.io/post/704728</link><guid isPermaLink="true">https://forum.qt.io/post/704728</guid><dc:creator><![CDATA[Sivan]]></dc:creator><pubDate>Wed, 02 Mar 2022 04:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Thu, 03 Mar 2022 13:36:15 GMT]]></title><description><![CDATA[<p dir="auto">As I said - I don't understand what you're doing. Your stuff will e.g. not work for 99.99...</p>
]]></description><link>https://forum.qt.io/post/704993</link><guid isPermaLink="true">https://forum.qt.io/post/704993</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Thu, 03 Mar 2022 13:36:15 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Thu, 03 Mar 2022 01:23:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a>  for some reason, I was not getting the correct result at first, this is why I opted for the first method in the first place. Now, I realize that more than coding, I have to be cautious about what I am displaying on the screen. I also, have to avoid my tendency to arrive at any conclusion so quickly.</p>
]]></description><link>https://forum.qt.io/post/704904</link><guid isPermaLink="true">https://forum.qt.io/post/704904</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Thu, 03 Mar 2022 01:23:50 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 16:24:42 GMT]]></title><description><![CDATA[<p dir="auto">The output 99.21 is correct don't know why you do such strange stuff just to add 0.01 to a float value though)</p>
]]></description><link>https://forum.qt.io/post/704864</link><guid isPermaLink="true">https://forum.qt.io/post/704864</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 02 Mar 2022 16:24:42 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 10:05:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sivan">@<bdi>Sivan</bdi></a> said in <a href="/post/704728">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704720">Operations with QString and int</a>:</p>
<p dir="auto">You are assigning ASCII value of 6 to the last character of string. Please refer to ASCII chart online. To simply answer your question, you can add '0' to ur last_dig. That should work.</p>
<pre><code> myStr[myStr_sz-1] = last_dig + '0'; 
</code></pre>
<p dir="auto">But why are u doing like this? What if the last digit is 9? When u add 1, you will need to add the second last digit as well. A better solution would be to completely convert the string to digit, do the arithmetric operation, and then convert it back to QString</p>
</blockquote>
<p dir="auto">Here's my try with real values</p>
<pre><code>  QString myStr = "99.20";
    qDebug()&lt;&lt;"old String is =" &lt;&lt;myStr;
    int indx = myStr.indexOf(".");
    myStr.remove('.');
    float myStr_int = myStr.toFloat();   //100  
    myStr_int +=1;
    QString myStrNew = QString::number(myStr_int);
    myStrNew.insert(indx,".");
    qDebug()&lt;&lt;"New int value is =" &lt;&lt;myStrNew.toFloat();
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/5eb7d6c7-b96b-4f58-acf2-27915e5b3958.png" alt="trial-6(b)_02.03.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/704779</link><guid isPermaLink="true">https://forum.qt.io/post/704779</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Wed, 02 Mar 2022 10:05:54 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 09:52:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sivan">@<bdi>Sivan</bdi></a> said in <a href="/post/704728">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704720">Operations with QString and int</a>:</p>
<p dir="auto">You are assigning ASCII value of 6 to the last character of string. Please refer to ASCII chart online. To simply answer your question, you can add '0' to ur last_dig. That should work.</p>
<pre><code> myStr[myStr_sz-1] = last_dig + '0'; 
</code></pre>
<p dir="auto">But why are u doing like this? What if the last digit is 9? When u add 1, you will need to add the second last digit as well. A better solution would be to completely convert the string to digit, do the arithmetric operation, and then convert it back to QString</p>
</blockquote>
<p dir="auto">Yes, your suggestion works perfectly well.</p>
<pre><code>    QString myStr = "31415";
    qDebug()&lt;&lt;"old String is =" &lt;&lt;myStr;
    int myStr_int = myStr.toInt();
    myStr_int +=1;
    qDebug()&lt;&lt;"New int value is =" &lt;&lt;myStr_int;
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/31e3e4ee-7fd0-45a4-90a2-63b9f056cbee.png" alt="trial-6(a)_02.03.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Trying with real vlaues</p>
<pre><code>    QString myStr = "99.99";
    qDebug()&lt;&lt;"old String is =" &lt;&lt;myStr;
    int myStr_int = myStr.toDouble();   //  And:100  [.toFloat() ]
    myStr_int +=1;
    qDebug()&lt;&lt;"New int value is =" &lt;&lt;myStr_int;
</code></pre>
]]></description><link>https://forum.qt.io/post/704777</link><guid isPermaLink="true">https://forum.qt.io/post/704777</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Wed, 02 Mar 2022 09:52:26 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 07:10:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704718">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">My current project requirement expects me to code in Qt C++ [ As I've mentioned earlier that my mind always approaches the solution of a program in Python first because of spending more time in coding in Python than C++]</p>
</blockquote>
<p dir="auto">So we are totally in opposite about the way to do: programming C++ but thinking the program with Python in mind is, for me, the worst way to do.</p>
<p dir="auto">C++ and python are so far apart in almost every aspect of programming, I can't see how this can work.<br />
If we are only talking about validating an algorithm, why not. But transposing from Python to C++ is not a simple matter. That alone amounts to a new development.</p>
]]></description><link>https://forum.qt.io/post/704743</link><guid isPermaLink="true">https://forum.qt.io/post/704743</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Wed, 02 Mar 2022 07:10:46 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 04:31:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704720">Operations with QString and int</a>:</p>
<p dir="auto">You are assigning ASCII value of 6 to the last character of string. Please refer to ASCII chart online. To simply answer your question, you can add '0' to ur last_dig. That should work.</p>
<pre><code> myStr[myStr_sz-1] = last_dig + '0'; 
</code></pre>
<p dir="auto">But why are u doing like this? What if the last digit is 9? When u add 1, you will need to add the second last digit as well. A better solution would be to completely convert the string to digit, do the arithmetric operation, and then convert it back to QString</p>
]]></description><link>https://forum.qt.io/post/704728</link><guid isPermaLink="true">https://forum.qt.io/post/704728</guid><dc:creator><![CDATA[Sivan]]></dc:creator><pubDate>Wed, 02 Mar 2022 04:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 02:50:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kromignon">@<bdi>KroMignon</bdi></a> said in <a href="/post/704629">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704624">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">With this modified code , I got the following result-</p>
</blockquote>
<p dir="auto">It is doing what you have coded.</p>
<pre><code>QString myStr = "31415";
 int myStr_sz = myStr.size(); // =&gt; myStr = 5
 int last_dig=myStr[myStr_sz-1].digitValue(); // =&gt; last_dig = 5
 last_dig+=1; /// =&gt; last_dig = 6
 myStr[myStr_sz-1] = last_dig;  // change  myStr[myStr_sz-1] from '5' to '\x06'
 qDebug()&lt;&lt;"New String is =" &lt;&lt;myStr;
</code></pre>
<p dir="auto"><strong>EDIT</strong>: you have to understand that 5 != '5', the ASCII code for 5 is 57 or '\x35'</p>
</blockquote>
<p dir="auto"><code>EXAMPLE-1</code></p>
<pre><code>int x = 56;
  QString str = QString::number(x);
  qDebug()&lt;&lt;"x = " &lt;&lt;str; // x ="56"
</code></pre>
<p dir="auto">Using Example 1 -<br />
I modified the code</p>
<pre><code> ```
 QString myStr = "31415";
 qDebug()&lt;&lt;"old String is =" &lt;&lt;myStr;  //31415
 int myStr_sz = myStr.size(); // =&gt; myStr = 5
 int last_dig=myStr[myStr_sz-1].digitValue(); // =&gt; last_dig = 5
 last_dig+=1; // =&gt; last_dig = 6
 qDebug()&lt;&lt;"incremented last dig is="&lt;&lt;last_dig;  // 6
 QString str_last =QString::number(last_dig);  
 qDebug()&lt;&lt;"incremented last dig after converting to string is="&lt;&lt;last_dig; // ==&gt; 6
 myStr[myStr_sz-1] = last_dig; 
 qDebug()&lt;&lt;"New String is =" &lt;&lt;myStr;
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/4addcdef-1713-40ce-a152-64301c1080c6.png" alt="trial-2_02.03.2022.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I am getting the same old result.</p>
<p dir="auto">Another way I'm thinking is that, popping out the last digit from the string and appending the incremented last digit . I tried it but didn't work. Please give suggestion .</p>
]]></description><link>https://forum.qt.io/post/704720</link><guid isPermaLink="true">https://forum.qt.io/post/704720</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Wed, 02 Mar 2022 02:50:00 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 02:28:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kromignon">@<bdi>KroMignon</bdi></a><br />
My current project requirement expects me to code in Qt C++ [ As I've mentioned earlier that my mind always approaches the solution of a program in Python first because of spending more time in coding in Python than C++]</p>
]]></description><link>https://forum.qt.io/post/704718</link><guid isPermaLink="true">https://forum.qt.io/post/704718</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Wed, 02 Mar 2022 02:28:26 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Wed, 02 Mar 2022 02:26:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mchinand">@<bdi>mchinand</bdi></a> said in <a href="/post/704670">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">It's not entirely clear, but from the wording of the original post (increase the last digit by one) and then in a subsequent message saying it should work with strings that contain floating-point numbers too, I think <a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> wants '35.456' to become '35.457', for example.</p>
</blockquote>
<p dir="auto">Yes, actually my true intention for putting this Question was about dealing with rounding of real values but I also wanted to be clear about the string and int conversion.</p>
]]></description><link>https://forum.qt.io/post/704717</link><guid isPermaLink="true">https://forum.qt.io/post/704717</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Wed, 02 Mar 2022 02:26:33 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 15:19:46 GMT]]></title><description><![CDATA[<p dir="auto">It's not entirely clear, but from the wording of the original post (increase the last digit by one) and then in a subsequent message saying it should work with strings that contain floating-point numbers too, I think <a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> wants '35.456' to become '35.457', for example.</p>
]]></description><link>https://forum.qt.io/post/704670</link><guid isPermaLink="true">https://forum.qt.io/post/704670</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Tue, 01 Mar 2022 15:19:46 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 10:09:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a></p>
<pre><code>template&lt;typename T&gt;
QString addOne(const QString &amp;string)
{
    auto value = std::is_floating_point&lt;T&gt;::value ? string.toDouble() : string.toInt();
    return QString::number(++value);
}

int main(int argc, char *argv[])
{
    qDebug() &lt;&lt; addOne&lt;int&gt;("12345") &lt;&lt; addOne&lt;float&gt;("1234.56");
}
</code></pre>
]]></description><link>https://forum.qt.io/post/704634</link><guid isPermaLink="true">https://forum.qt.io/post/704634</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 01 Mar 2022 10:09:54 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 10:05:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704632">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">Yes, it works absolutely fine. I was trying this with real values say - myStr = " 314.19"</p>
</blockquote>
<p dir="auto">Please again, don't program in C++ as you would do it in python, this will not work!<br />
There is no implicit convertion from string &lt;=&gt; real or string &lt;=&gt; integer in C++.<br />
I you want to program in python style, use python not C++ or you will only go frustrated.</p>
]]></description><link>https://forum.qt.io/post/704633</link><guid isPermaLink="true">https://forum.qt.io/post/704633</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Tue, 01 Mar 2022 10:05:18 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 10:01:00 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk  Yes, it works absolutely fine. I was trying this with real values say - myStr = " 314.19"</p>
]]></description><link>https://forum.qt.io/post/704632</link><guid isPermaLink="true">https://forum.qt.io/post/704632</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Tue, 01 Mar 2022 10:01:00 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:59:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704624">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">With this modified code , I got the following result-</p>
</blockquote>
<p dir="auto">It is doing what you have coded.</p>
<pre><code>QString myStr = "31415";
 int myStr_sz = myStr.size(); // =&gt; myStr = 5
 int last_dig=myStr[myStr_sz-1].digitValue(); // =&gt; last_dig = 5
 last_dig+=1; /// =&gt; last_dig = 6
 myStr[myStr_sz-1] = last_dig;  // change  myStr[myStr_sz-1] from '5' to '\x06'
 qDebug()&lt;&lt;"New String is =" &lt;&lt;myStr;
</code></pre>
<p dir="auto"><strong>EDIT</strong>: you have to understand that 5 != '5', the ASCII code for 5 is 57 or '\x35'</p>
]]></description><link>https://forum.qt.io/post/704629</link><guid isPermaLink="true">https://forum.qt.io/post/704629</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:59:38 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:55:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/704620">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704619">Operations with QString and int</a>:</p>
</blockquote>
<blockquote>
<p dir="auto"><strong>Also, think about what should happen if last number is 9?</strong></p>
</blockquote>
<p dir="auto">Yes, this is in my mind, it's the next stage of this trial but before that, I need to be sure about the working of incrementation.</p>
]]></description><link>https://forum.qt.io/post/704627</link><guid isPermaLink="true">https://forum.qt.io/post/704627</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:55:56 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:56:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a></p>
<p dir="auto">what's wrong with</p>
<pre><code>QString myStr = "31415";
int myInt = myStr.toInt();
myStr = QString::number(++myInt);
</code></pre>
<p dir="auto">?</p>
]]></description><link>https://forum.qt.io/post/704626</link><guid isPermaLink="true">https://forum.qt.io/post/704626</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:56:04 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:53:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kromignon">@<bdi>KroMignon</bdi></a> Yes, I am acquainted with the fact that Qt is the framework of C++ but I struggle to work with its classes and functions.</p>
]]></description><link>https://forum.qt.io/post/704625</link><guid isPermaLink="true">https://forum.qt.io/post/704625</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:53:27 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:52:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a></p>
<pre><code>QString myStr = "31415";
 int myStr_sz = myStr.size();
 int last_dig=myStr[myStr_sz-1].digitValue();
 last_dig+=1;
 myStr[myStr_sz-1] = last_dig;
 qDebug()&lt;&lt;"New String is =" &lt;&lt;myStr;
</code></pre>
<p dir="auto">With this modified code , I got the following result-<br />
<img src="https://ddgobkiprc33d.cloudfront.net/46d8e1d8-363d-4707-846a-41ed11f85292.png" alt="last_dig_incr.png" class=" img-fluid img-markdown" /><br />
Though it's not the desired output , yet I loved the appearance of <code>Spade</code> from nowhere!</p>
]]></description><link>https://forum.qt.io/post/704624</link><guid isPermaLink="true">https://forum.qt.io/post/704624</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:52:22 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:48:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704622">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">I was working in Python before starting to work in Qt, even though I have studied c++ before</p>
</blockquote>
<p dir="auto">Again Qt is <strong>not a programming language</strong>, Qt is a <strong>framework</strong> developped in C++.<br />
Like django is a web framework developped in Python.</p>
]]></description><link>https://forum.qt.io/post/704623</link><guid isPermaLink="true">https://forum.qt.io/post/704623</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:48:59 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:41:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kromignon">@<bdi>KroMignon</bdi></a><br />
Thanks for your suggestion. I was working in Python before starting to work in Qt, even though I have studied c++ before, I feel my reasoning is biased towards Python's logic and syntax.</p>
]]></description><link>https://forum.qt.io/post/704622</link><guid isPermaLink="true">https://forum.qt.io/post/704622</guid><dc:creator><![CDATA[Swati777999]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:41:35 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:19:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704619">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">This has not modifed myStr . Can someone tell me where I am going wrong?</p>
</blockquote>
<p dir="auto">Qt is a C++ framework, so please take time to learn some C++ basics.<br />
It looks to me as you are expected Qt/C++ working as another language like Python or JavaScript.<br />
But that's not the case, and will never be!</p>
<p dir="auto">Each programming language has his own way to work, so please learn C++ if you want to use Qt or maybe PySide (Qt binding for Python) is a better alternative for you.</p>
]]></description><link>https://forum.qt.io/post/704621</link><guid isPermaLink="true">https://forum.qt.io/post/704621</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:19:24 GMT</pubDate></item><item><title><![CDATA[Reply to Operations with QString and int on Tue, 01 Mar 2022 09:20:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/swati777999">@<bdi>Swati777999</bdi></a> said in <a href="/post/704619">Operations with QString and int</a>:</p>
<blockquote>
<p dir="auto">This has not modifed myStr</p>
</blockquote>
<p dir="auto">Why should it? You do not modify it.<br />
You also need to replace the last character in myStr with the new number.<br />
Use <a href="https://doc.qt.io/qt-5/qstring.html#operator-5b-5d" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qstring.html#operator-5b-5d</a></p>
<p dir="auto">Also, think about what should happen if last number is 9?</p>
]]></description><link>https://forum.qt.io/post/704620</link><guid isPermaLink="true">https://forum.qt.io/post/704620</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 01 Mar 2022 09:20:27 GMT</pubDate></item></channel></rss>