src/Knifer/Gimela.Knifer.CommandLines.Foundation/CommandLineParser.cs
/// <summary>
/// Returns the next string token in the argument list.
/// </summary>
/// <param name="args">list of string tokens</param>
/// <param name="index">index of the current token in the array</param>
/// <returns>the next string token, or null if no more tokens in array</returns>
Returns the next string token in the argument list.
Returns the next string token in the argument list .
private static string NextToken(string[] args, ref int index)
    {
      if (index < 0)
        throw new ArgumentOutOfRangeException("index");
      if (index >= args.Length)
        throw new ArgumentOutOfRangeException("index");
      string token = string.Empty;
      while (index < args.Length)
      {
        token = args[index].Trim();
        if (!string.IsNullOrEmpty(token))
        {
          break;
        }
        else
        {
          index++;
        }
      }
      return token;
    }
private static string NextToken ( string [ ] args , ref int index ) { if ( index < 0 ) throw new ArgumentOutOfRangeException ( " " ) ; if ( index >= args . Length ) throw new ArgumentOutOfRangeException ( " " ) ; string token = string . Empty ; while ( index < args . Length ) { token = args [ index ] . Trim ( ) ; if ( ! string . IsNullOrEmpty ( token ) ) { break ; } else { index ++ ; } } return token ; }
Returns the next string token in the argument list.
Returns the next string token in the argument list .
the next string token, or null if no more tokens in array
the next string token or null if no more tokens in array
args
string[]
list of string tokens
list of string tokens
int
ref
index
index of the current token in the array
index of the current token in the array