Tinkr2/4.2/AphelionCore/AphelionCore/Helpers/Strings.cs
/// <summary>
/// Tokenizes a line while accounting for quotes
/// </summary>
/// <param name="command">String to tokenize</param>
/// <returns>Returns the tokenized string.</returns>
Tokenizes a line while accounting for quotes
Tokenizes a line while accounting for quotes
public static string[] Tokenize(string command)
      {
         string[] res = SplitComponents(command, ' ');
         for (int i = 0; i < res.Length; i++)
         {
            res[i] = res[i].Trim();
            if (res[i].Substring(0, 1) == "\"" && res[i].Substring(res[i].Length - 1) == "\"")
            {
               res[i] = res[i].Substring(1, res[i].Length - 2);
            }
         }
         return res;
      }
public static string [ ] Tokenize ( string command ) { string [ ] res = SplitComponents ( command , ' ' ) ; for ( int i = 0 ; i < res . Length ; i ++ ) { res [ i ] = res [ i ] . Trim ( ) ; if ( res [ i ] . Substring ( 0 , 1 ) == " \" " && res [ i ] . Substring ( res [ i ] . Length - 1 ) == " \" " ) { res [ i ] = res [ i ] . Substring ( 1 , res [ i ] . Length - 2 ) ; } } return res ; }
Tokenizes a line while accounting for quotes
Tokenizes a line while accounting for quotes
Returns the tokenized string.
Returns the tokenized string .
command
string
String to tokenize
String to tokenize