Adding single quotes (') to a Comma Separated String Variable

Good morning everyone and happy Wednesday :),

I have a string variable that contains the following str_var = 123, 654, 283, 1344

Is there a way to add single quotes around each one of those numbers so make the string variable look like this str_var = ‘123’, ‘654’, ‘283’, ‘1344’ .

I was thinking of transforming it into an array and having a For Loop go through each one and reassigns the numbers with single quotes but I was wondering if there is an easier / more efficient way of doing this.

Thank you :slight_smile:

Assign str_var to
"'" + str_var.Replace(", ", "', '") + "'".

3 Likes

@sasho1987, Try this:

str_var = str_var.Replace(" “, “”)
str_var = “’” + str_var.Replace(”,", “’,’”) + “’”

Cheers:)

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.