Replace characters in csv file

Discuss RoboTask here
Post Reply
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Replace characters in csv file

Post by rice1973 »

Hi Oleg,I have a csv (text file) with 30 columns. Now i want to change certain characters in column 29. "space" has to be replaced by "_" and all upper characters have to be made lower case. Fields are devided by "," and fields are starting and ending with """ .Example;"nice","is","this", "text line","This One"has to become;"nice","is","this", "text line","this_one"So replacements have to be done in one column and not complete csv.Please advice.Best regards,Maurice
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Replace characters in csv file

Post by Oleg »

Suppose you set the value into variable MyVar

Take the 29-th column {MyVar(29)} and replace the spaces with "_" character (STR replace action) and set it to new variable NewField. Also you can do uppercase and lowercase the string (see system variables Uppercase and Lowercase)

Next, you can compose new string:
"{MyVar(0)}","{MyVar(1)}","{MyVar(2)}",.....,"{MyVar(28)}"," {LowerCase({NewField})}"
Post Reply