Tinkr2/4.2/AphelionCore/AphelionCore/Helpers/Strings.cs
/// <summary>
/// Returns true if the specified location is inside of a quote set
/// </summary>
/// <param name="value">String to check</param>
/// <param name="position">Location withing the string to check</param>
/// <returns>true if the location is inside quotes; else false</returns>
Returns true if the specified location is inside of a quote set
Returns true if the specified location is inside of a quote set
public static bool InQuotes(string value, int position)
      {
         int qcount = 0;
         int iStart = 0;
         while (true)
         {
            int i = value.IndexOf('"', iStart);
            if (i < 0 || i >= position)
            {
               return qcount % 2 != 0;
            }
            if (i > 0 && value.Substring(i, 1) != "\\" || i == 0)
            {
               qcount++;
            }
            iStart = i + 1;
         }
      }
public static bool InQuotes ( string value , int position ) { int qcount = 0 ; int iStart = 0 ; while ( true ) { int i = value . IndexOf ( ' ' , iStart ) ; if ( i < 0 || i >= position ) { return qcount % 2 != 0 ; } if ( i > 0 && value . Substring ( i , 1 ) != " \\ " || i == 0 ) { qcount ++ ; } iStart = i + 1 ; } }
Returns true if the specified location is inside of a quote set
Returns true if the specified location is inside of a quote set
// Find next instance of a quote // If not return our value // Check if it's a qualified quote
true if the location is inside quotes; else false
true if the location is inside quotes ; else false
value
string
String to check
String to check
position
int
Location withing the string to check
Location withing the string to check