Solved

Having problems in converting string to an string[]

Posted on 2007-03-21
1
162 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now