Replace single quote with double single quotes

Hi,

I want to replace single quotes with double single quotes
ex: PSY’D with PSY’'D

This should replace from entire data table not on a particular column using UiPath.

HI @karthik_kulkarni1

- Assign -> Input = "PSY'D"
- Assign -> Output = Input.Replace("'","''")

Check the below image for better understanding.

To change the single quote with double single quotes for a column in a datatable.
Take a for each row in datatable activity inside of this insert the assign activity.

- Assign -> Currentrow("Column name") = Currentrow("Column name").Replace("'","''")

Hope it helps!!

Hi @karthik_kulkarni1

For Each row In dataTable.Rows
    For Each col In dataTable.Columns
        row(col) = row(col).ToString.Replace("'", "''")
    Next
Next

A LINQ Approach

From r In dtData.AsEnumerable
let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.Replace("'","''")).toArray()
Select dtCorrected.Rows.Add(ra)).CopyToDataTable()

HI @karthik_kulkarni1

Please check the below xaml


ReplaceSingleQuotesWithDoubleQuotes.txt (345 Bytes)
Main.xaml (18.5 KB)

Input:

output:
image

Regards

This is working but the issue is when I am trying to push same in to database I am getting error , as it is not accepting single quotes.