Skip to content

Instantly share code, notes, and snippets.

@SamKr
Created June 5, 2020 15:13
Show Gist options
  • Save SamKr/73eb3367ef46cc3a0b8c71e1bcaa5a88 to your computer and use it in GitHub Desktop.
Save SamKr/73eb3367ef46cc3a0b8c71e1bcaa5a88 to your computer and use it in GitHub Desktop.
internal static string GetQuotedValue(string value)
{
try
{
if (!value.Contains("\"")) return string.Empty;
var values = from Match match in Regex.Matches(value, "\"([^\"]*)\"") select match.ToString();
var resultArray = values as string[] ?? values.ToArray();
return !resultArray.Any() ? string.Empty : resultArray.First().Replace("\"", "");
}
catch (Exception ex)
{
Log.LogException(ex);
return string.Empty;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment