mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-13 19:55:02 +00:00
feat: Adding enquote util method
This commit is contained in:
@@ -688,5 +688,24 @@ namespace ICD.Common.Utils
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures the value starts and ends with a double quote.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string Enquote(string value)
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException("value");
|
||||
|
||||
if (!value.StartsWith('"'))
|
||||
value = '"' + value;
|
||||
|
||||
if (!value.EndsWith('"'))
|
||||
value += '"';
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user