[Modify] Polish it

This commit is contained in:
sta 2019-06-07 19:47:37 +09:00
parent b27b8ee742
commit cfeeb9c9ba

View File

@ -1402,10 +1402,14 @@ namespace WebSocketSharp
/// </param> /// </param>
public static bool IsEnclosedIn (this string value, char c) public static bool IsEnclosedIn (this string value, char c)
{ {
return value != null if (value == null)
&& value.Length > 1 return false;
&& value[0] == c
&& value[value.Length - 1] == c; var len = value.Length;
if (len < 2)
return false;
return value[0] == c && value[len - 1] == c;
} }
/// <summary> /// <summary>