Created
March 26, 2010 20:56
-
-
Save rtipton/345382 to your computer and use it in GitHub Desktop.
C# -- Split Delimited String
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace Split_Test | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string values = "PTT, Non-Provider OT, Non-Provider ST"; | |
string[] rpmCreds = values.Split(','); | |
try | |
{ | |
string Role = rpmCreds[0].Trim(); | |
string NPRole1 = rpmCreds[1].Trim(); | |
string NPRole2 = rpmCreds[2].Trim(); | |
Console.WriteLine(Role); | |
Console.WriteLine(NPRole1); | |
Console.WriteLine(NPRole2); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment