How to use replace for double quotes

Hi Everyone ,

My requirement is i need to replace the different types of double quotes

“ - “
” - ”
" - &quot

i have to replace these garbage values with quotes

eg: row1(“Col0”).Tostring.Replace(“””,“”") i am getting error for this @Palaniyappan @Gokul001 please help

Thanks in advance

Hi,

The following post might help you. Can you try to use ChrW(8220) and ChrW(8221)?

Regards,

Protoyped the replacing with replacing to # for visual reasons
grafik

strPattern = String.Format("({0})", String.Join("|",{"""",ChrW(8220),ChrW(8221),"""}))
 strPattern
 "(\"|“|”|")"
 strText
 @"“ - “
 ” - ”
 “ - ”
 "" - ""
 "" - ""
 Regex.Replace(strText, strPattern,"#")
 @"# - #
 # - #
 # - #
 # - #
 # - #"

No , i need to replace &#8220 with “ or ” or " , not the other way around

@kavya.s16 , Could you provide us with sample inputs that contain these kind of values that we need to replace?

We want to identify if it follows a particular pattern or is it always the same value.

Company Holdings Advisors (Beijing) Company Limited (“BJWFOE”)

Is being extracted as Company Holdings Advisors (Beijing) Company Limited ("BJWFOE")

so i am trying to replace it
HTML 4.0 Special Entities according to data in this link

“ - & #8220;
” - & #8221;
" - & quot;

i have to replace them respectively

As showcased above

  • define an array of characters/strings you want to replace
  • get from this the regex pattern
  • replace it with Regex.Replace

can u provide the xaml if possible please!!

could u tell how to replace it with quotes instead of #

& #8220; -------
& #8221; --------
& quot; -------"

@Palaniyappan @Gokul001

Hi @kavya.s16,

As @supermanPunch suggested, please provide both

  1. Your input sample strings
  2. Your required output after the replace

This way the forum members get a better idea what your inputs and expected output are. In such forums, asking questions clearly is important to get your problem resolved quickly.

above are the extracted data with garbage value/html entities
below is the actual data , so i need to use replace function @Palaniyappan @Gokul001 @jeevith @supermanPunch @ppr

@kavya.s16 , In that case, could you provide us with this Excel File, it would help us faster to work on the solution/suggest the steps required.

apologies , uploading file from client machine is restricted , i could just provide screenshot :frowning:

Lets Crosscheck If HTML entity Decoding will better serve for the case

1 Like

Hi,

FYI, the following is ppr’s way.

image

System.Web.HttpUtility.HtmlDecode(yourString)

Regards,

1 Like

do i need to install any package to use this?

Hi,

Nope, we can use this method in default settings.

Regards,

@kavya.s16

for using

HttpUtility.HtmlDecode(yourString)

we will modify the XAML file in some cases, when the statement is not recognized by the compiler

  • Take a backup from your file in advance
  • open the xaml within a text editor (e.g. notepad++)
    add following line to it

    <AssemblyReference>System.Web</AssemblyReference>
    reopen it in Studio

find starter help here:
EncodeDecodeStrings.xaml (5.5 KB)

Hi @Yoichi , i need to replace with this string which is left double quotation mark

I used HttpUtility.HtmlDecode(““”).Replace(“)
but it says string constants must end with double quotes @Palaniyappan @ppr

could u please help

Hi,

Do you want to replace double quote with left double quote? If so, the following will work

yourString.Replace(Chr(34),ChrW(8220))

Regards,