Skip to content

Instantly share code, notes, and snippets.

@rtipton
Created March 26, 2010 20:56
Show Gist options
  • Save rtipton/345382 to your computer and use it in GitHub Desktop.
Save rtipton/345382 to your computer and use it in GitHub Desktop.
C# -- Split Delimited String
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