i am importing a CSV file that has quotes around text, but my SUT will not accept the quotes as input.
Will it be possible to easily remove the quotes from ALL of my variables?
Here is a shortexample
Put File “Profiles.csv” into T1
Put Word 1 of line 1 of T25 into W1
Put Word 2 of line 2 of T25 into W2
This will output
“18 Main Street”.
But I need the putput without the "'s
If i add this to the script it works,
delete all occurrences of <<">> from T1
delete all occurrences of <> from" for every one of those variables…
I don’t understand what’s wrong with the solution you already have. What do you need that you’re not getting from deleting all the quotes from the file?
that solution works, but I’m going to have to type it 300+ times, once for each variable. I was hoping for a more direct solution that isn’t so ugly and long.
You read the whole file into a variable and then used the command to strip the quotes out of the variable holding the file, so there shouldn’t be any quotes to worry about anymore. You could also just write the file with the quotes stripped out back to either the original file or a different one and then use that.
To rework your original example, just do this:
Put File "Profiles.csv" into T1
remove quote from T1
Put Word 1 of line 1 of T1 into W1
Put Word 2 of line 2 of T1 into W2
This should output:
18 Main Street
You can also just “put” the words directly from the lines or from the file:
Put Word 1 of line 1 of T1
Put Word 2 of line 2 of T1
As Matt pointed out, if you delete the quotes from the source (right after you read it from the file) before you assign different parts of it to different variables, then of course you won’t have to delete the quotes from each variable.
But I think it looks like you’re using the quoted word feature of word chunks, which includes the quotes as part of the word. If so, you won’t want to delete all of the quotes until after you access the “words”. To deal with this, you might want to write a simple “dequote” function to strip off the quotes if present. Here’s a simple dequote script that will remove quotes if they’re present:
if theWord begins with quote and theWord ends with quote
then return chars 2 to -2 of theWord
else return theWord
You could use such a dequote script like this:
Put dequote(Word 1 of line 1 of T25) into W1
Is that a little simpler?