/// <summary> /// Tries to remove formatting specific to this parser's expected type. /// </summary> /// <param name="text">The text to remove formatting from.</param> /// <returns>Whether or not the expected formatting was found and succesfully removed.</returns> internal virtual bool TryRemoveFormatting(ref string text) { if (this.prefix != null) { if (!WebConvert.TryRemovePrefix(this.prefix, ref text)) { return(false); } } bool shouldBeQuoted = this.prefix != null || ValueOfTypeCanContainQuotes(this.expectedType); if (shouldBeQuoted && !WebConvert.TryRemoveQuotes(ref text)) { return(false); } if (this.suffix != null) { // we need to try to remove the literal even if it isn't required. if (!TryRemoveLiteralSuffix(this.suffix, ref text) && this.suffixRequired) { return(false); } } return(true); }
/// <summary> /// Tries to remove formatting specific to this parser's expected type. /// </summary> /// <param name="text">The text to remove formatting from.</param> /// <returns> /// Whether or not the expected formatting was found and succesfully removed. /// </returns> internal override bool TryRemoveFormatting(ref string text) { if (!WebConvert.TryRemovePrefix(XmlConstants.LiteralPrefixBinary, ref text)) { return(false); } if (!WebConvert.TryRemoveQuotes(ref text)) { return(false); } return(true); }