## Recently I needed to add two double quotes in certain places in a text file that my script was building.
## Certain ASCII characters can be tricky to deal with. I get around the problem by assigning the ASCII value(s)
## to a variable, then just call the variable when needed. The ASCII value for a double quote is 34, and I
## needed to add two double quotes. Here's how I built the variable:
$quotes = [char]34+[char]34
## Then to use it, just build your output string like this:
$outputString = $quotes + $receivedDateMonth + $quotes + $receivedDateDay + $quotes + $receivedTimeHour + $quotes + $receivedTimeMinute + $quotes
## To build a proper comma separated file, assign one double quote to a variable, then assign a double quote,
## comma, and another double quote to a variable, then build your output string accordingly.
$quotes = [char]34
$comma = [char]34+[char]59+[char]34
$outputString = $quotes + $receivedDateMonth + $comma + $receivedDateDay + $comma + $receivedTimeHour + $comma + $receivedTimeMinute + $quotes
Comments