in src/Microsoft.Azure.NotificationHubs/Messaging/ExpressionEvaluator.cs [214:254]
static int ExtractLiteral(string fullExpression, string tokenBegin, Token token)
{
int tokenEndIndex = 0;
int startLookingFromIndex = 1;
char literalSeperator = token.Type == TokenType.SingleLiteral ? '\'' : '\"';
bool escapeCharsFound = false;
while (true)
{
tokenEndIndex = tokenBegin.IndexOf(literalSeperator, startLookingFromIndex);
if (tokenEndIndex == -1)
{
throw new InvalidDataContractException(string.Format(SRClient.ExpressionLiteralMissingClosingNotation, fullExpression, tokenBegin));
}
if (tokenEndIndex + 1 < tokenBegin.Length && tokenBegin[tokenEndIndex + 1] == literalSeperator)
{
escapeCharsFound = true;
startLookingFromIndex = tokenEndIndex + 2;
continue;
}
else
{
string literal = tokenBegin.Substring(1, tokenEndIndex - 1);
if (escapeCharsFound)
{
token.Property = token.Type == TokenType.DoubleLiteral ? literal.Replace(@"""""", @"""") : literal.Replace(@"''", @"'");
}
else
{
token.Property = literal;
}
break;
}
}
return tokenEndIndex;
}