CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Combine or Split Arguments

239 Views
Copy Code Show/Hide Line Numbers
/// <summary>
/// Splits the id seqence values.
/// </summary>
/// <param name="combinedArgs">The combined args.</param>
/// <returns></returns>
private int[] SplitIdSeqenceValues(object combinedArgs)
{
    var args = new int[3];
 
    static readonly Regex _argsSeperator = new Regex(@"\D+", RegexOptions.Compiled);
 
    string[] splitedIntegers = _argsSeperator.Split(combinedArgs.ToString());
 
    for (int i = 0; i < splitedIntegers.Length; i++)
    {
        args[i] = Convert.ToInt32(splitedIntegers[i]);
    }
 
    return args;
}
 
/// <summary>
/// Combines the id seqence values.
/// </summary>
/// <param name="id">The id.</param>
/// <param name="seqenceNo">The seqence no.</param>
/// <returns></returns>
private string CombineIdSeqenceValues(int id, int seqenceNo)
{
    StringBuilder combinedArg = new StringBuilder();
 
    combinedArg.Append(id);
 
    combinedArg.Append("&");//STR_ARG_SEPERATOR
 
    combinedArg.Append(seqenceNo);
 
    return combinedArg.ToString();
}
by kannan M ambadi
  September 28, 2009 @ 12:04am
Tags:

by Abhilash    September 28, 2009 @ 9:43am

very useful code paste...........keep it up

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate