Solved

Having problems in converting string to an string[]

Posted on 2007-03-21
1
165 Views
Last Modified: 2010-04-16
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
Comment
Question by:mousemat24
1 Comment
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18764566
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question