DotNetKick.com is an open-source project. Please report any bugs and let us know your great suggestions. Currently running svn revision 620 (rss)

Kick Spy!, Kick Zeitgeist and Kick Widgets

adammal Subscribe to this feed
adammal
Profile Kicked Submitted Comments Tags Friends Kicked By Friends Submitted By Friends


Comments:

Sorry Alvin, i couldn't see your Reference Card. :(

@sukhjinder82
I'm not sure this is an appropriate place for this kind of question but in the interest of helping out a fellow programmer here is one of the many ways you could solve this problem.

public static string SplitTheString(string theString)
{

// Argument Check
if (string.IsNullOrEmpty(theString))
{
return theString;
}

// Define the token to split the string on.
string splitToken = "_";

// Split the string using the "_" token
string[] splits = theString.Split(new string[] {splitToken}, StringSplitOptions.None);

// if splits have been found then return the first split together with the original token.
if (splits != null && splits.Length > 0)
{
return splits[0] + splitToken;
}

// no split was found, just return the original string.
return theString;

}
posted by adammal 1 month, 29 days ago
 

Sponsored Link: www.carlist.ie

Search:

Ads via The Lounge