In my Resource.resx file I have a field where I put a sequence of strings like:
"string1" "string two" "this is the string 3"
My goal is to obtain a sequence of strings.
What I did until now is the following:
private static string[] mystrings = Resource.str.Split(null);
but this just split the strings based on the space character. For the second and third strings this is a problem, so it is better to parse strings between " ".
Is there a way to do this?
You could use string.Trim
to remove the leading/ending quotes and then string.Split
and pass " "
as the parameter to split the strings.
private static string[] mystrings = Resource.str.Trim('"').Split("\" \"", StringSplitOptions.None);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.