Hi Dmitriy,

Thanks for the information! I just started to learn QT C++ :)

Cheers,
Dylan

> -------- Original Message --------
> Subject: Re: [SailfishDevel] QT String issue
> Local Time: 12 September 2017 12:41 PM
> UTC Time: 12 September 2017 10:41
> From: dpur...@gmail.com
> To: Dylan Van Assche <dylan.van.ass...@protonmail.com>, Sailfish OS 
> Developers <devel@lists.sailfishos.org>
>
> Hi Dylan,
> trimmed() removes whitespaces only. You need to replace \" with an empty 
> string and "escape" both \ and ". You need escaping because this is how 
> string literals in C/C++ work. Try calling str.replace("\\\"", ""), where str 
> an object of QString.
>
> Also note that trimmed() is a const method and does not change the object for 
> which it was called. I.e.
>
> QString str1 = "  a  ";
> str1.trimmed();
> // str1 is unchanged but returns a QString object which is "a"
>
> Cheers
> Dmitriy
>
> On Tue, Sep 12, 2017 at 12:25 PM, Dylan Van Assche via Devel 
> <devel@lists.sailfishos.org> wrote:
>
>> Hi,
>>
>> I'm reading the sfos-release and the hw-release file in /etc from C++ but 
>> for some lines I get this in my strings as output:
>>
>> "\"Intex Aqua Fish\""
>>
>> I tried trimmed() and remove() but I can't figure out how to clean it 
>> correctly. The \" characters are annoying.
>>
>> Kind regards,
>> Dylan Van Assche
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to