From the Excel cell I download text in the form of strings. Sometimes they have two different types of quotation marks “-char (34) or ” I would like to remove them, but only if they appear at the end of the text. I use the text.TrimEnd (”“”“c) method for this but it only works for one kind of quotation mark. How to write the arguments of the trimEnd metod so that it works with the other quotation marks?
text.TrimEnd (”””"c) not work, but does not cause any error either. It just doesn’t remove the quotation mark.
for illustration, both characters are decoded:
Check this code in assign activity:
It should remove both kind of quotation marks only if they are at the ond of the string.
if you Want to Remove both “” and ”“ you can try
Replace Function like this
"yourstring”“”“".Replace("”“"c& """"c," ").Trim
But I have to remove the quotation marks at the end of the text only. Sometimes they appear inside and then they have to stay.
And these quotation marks do not always appear at the end of the text.
and when i tried checking your suggestion
a got erros message:
Assign: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.
If you already know character code (unicode) to be removed, the following will work.
It almost worked.
still need to take into account the code page somehow?
Assign: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
The following post will help you.
Unfortunately, test with the text ““Łódzkie” support the integration of foreigners” returned all quotation marks unchanged using your expression
The above expression is same as TrimEnd. If you need to delete all quote, the following works.
This expression removes character
0x94. If your string contains other double quote character, please add its code. Or can you share your string as a file using WriteTextFile activity? Because, in this forum, some characters are automatically converted to other.
we can use here an char array
So the idea is to bring the different quotes within an char array
e.g. (we used
"Łódzkie““" but immediate panel has a different visualization)
Another forced approach could be:
But for this we have manually to add the System.Web assembly by manually editing the XAML
Another Variation combining along with @Yoichi Unicode could be
From where we following ASC outputs can derive:
helped me your post in discussion
after this method is called correctly, t.trimEnd(char(148)) works
HI @ppr PPR
Thank you for your suggestions and commitment. We solved the problem after hints @Yoichi . It consisted not of an incorrect trimEnd call, but of settings at the Encoding.RegisterProvider level.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.