/// <summary> /// Determines if a path segment contains a specified directory separator. /// Detecting the use of a directory-separator by a path-segment requires an extra step beyond just determining if the path-segment contains the directory-separator. /// A path-segment can contain both Windows and non-Windows directory-separators, in which case the first directory-separator is the detected directory-separator because it is dominant. /// Validation is performed on the directory separator. /// </summary> /// <remarks>Similar to <see cref="DirectorySeparator.IsDirectorySeparatorDetected(string, string)"/>, but uses an alternate, simpler, <see cref="String.Contains(string)"/> logic that should give the same answer, but just in case provides and alternate test.</remarks> public static bool ContainsDirectorySeparator(string pathSegment, string directorySeparator) { DirectorySeparator.Validate(directorySeparator); var output = DirectorySeparator.ContainsDirectorySeparatorUnchecked(pathSegment, directorySeparator); return(output); }
public bool ContainsDirectorySeparatorUnchecked(string pathSegment, string directorySeparator) { var output = DirectorySeparator.ContainsDirectorySeparatorUnchecked(pathSegment, directorySeparator); return(output); }
/// <summary> /// Determines if a path segment contains a Windows directory separator. /// </summary> /// <remarks>Similar to <see cref="DirectorySeparator.IsNonWindowsDirectorySeparatorDetected(string)"/>, but uses an alternate, simpler, <see cref="String.Contains(string)"/> logic that should give the same answer, but just in case provides and alternate test.</remarks> public static bool ContainsNonWindowsDirectorySeparator(string pathSegment) { var output = DirectorySeparator.ContainsDirectorySeparatorUnchecked(pathSegment, DirectorySeparator.NonWindows); return(output); }