• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

Having problems in converting string to an string[]

Hi there

wonder if you can help me?

I have the following in a SQL field

"Launch", "1st", "2nd"

I want to get the value of that field using:

string[] roleoutType =   {systemSettings.displayContent("roleoutType") };

The problem is when I hover over the variable it says:

Dimensions:[1]
and the value of it is "\"Launch\", \"1st\", \"2nd\""

When it should be
Dimensions:[3]

Can someone please help me in getting this to work?

Thanks
Mousemat24
0
mousemat24
Asked:
mousemat24
1 Solution
 
dstanley9Commented:
use string.Split():

string source= "\"Launch\", \"1st\", \"2nd\"";
string[] parts = source.Split(',');

if you want to remove the quote marks:

string[] parts = source.Replace('"','').Split(',');


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now