adding single quotation to a string
44 views (last 30 days)
my code accept just this format of String --> filename='"GComScan_20200115_135716.sdb"' (first and last Quotes are single) why i dont know ?
i have tried with this command to get that, but the result was reverse, means first and last Quotes are dobble " ' ' " (without space).
filename = "'" + string(extractBetween(filename, "Scans\\", filename(end)))+ "'"
the right one;
How can I solve this issue? Thank you.
Adam Danz on 15 Jan 2020
Edited: Adam Danz on 15 Jan 2020
filename = sprintf('"%s"',string(extractBetween(filename, "Scans\\", filename(end))));
filename2 = '"GComScan_20200115_135716.sd"'
filename is actually a character array, not a string (see Characters & Strings to understand the difference). The double quotes are part of the character vector. The outer single quotes are not part of the character vector; they actually define the variable as a character vector.
To see the actual content of the filename variable,