You are not logged in.


Monday, December 14th 2015, 7:53pm

Removing all occurances of "Right-to-left" and "Left-to-right" marks from a Qstring

QT Beginner here so bear with me... Anyways one of our apps is outputting a log file that we then retrieve from the user and extract important information from. Since our app can run under many different languages we want to make sure that the specific entries we are looking for are all consistent in format. I am now testing right-to-left languages and noticed that the strings are not correctly formatted and therefore I was looking into maybe stripping out the Right-to-left (\u200F), and Left-to-Right (\u200E) characters so that the entries that we are looking for are consistent.

I have tried both the .remove and .replace functions but I get the following error: "error: not instance of overloaded function "QString::replace" : 5 overloads have no legal conversion for "this" pointer"

So what would be the best way to remove/delete all occurrences of "\u200F" and "\u200E" in a Qstring that is coming into my function in the format of: const QString &text

Thanks for any help on this one.


Tuesday, December 15th 2015, 2:33pm

Okay I was able to get passed the error, but I still can not seem to get the right-to-left text to appear how I would like it. I need to remove the right-to-left and left-to-right marks (\u200F and \u200E) so that the output format is what I need. So here is what one of the lines comes out as:

١٤:٥٠:١٣[D][TID:4064] "MSI_ACTION_END" "|برامج تشغيل منتجات SMART|‏‏تم انتهاء الإجراء 14:50:13: SystemFolder.5C5903CB_BE33_4666_90A3_1A9D606DF91B. إرجاع القيمة 1.|" "0|ms|"
But I need the ending to have the int and ms entries: |int|ms|, so something like how this English string comes out:

٠٧:٠٨:٥٣[D][TID:3772] "MSI_ACTION_END" "|SMART Product Drivers|Action ended 07:08:53: SystemFolder.5C5903CB_BE33_4666_90A3_1A9D606DF91B. Return value 1.|0|ms|"

So if anyone knows how to manipulate right-to-left languages so that I can modify the output to a log and have the text formatted correctly I would appreciate all feed back...

I have tried the following but it does not seem to do anything:



So again any help would be appreciated.