Determines whether a path includes a file extension.
[Visual Basic] Public Shared Function HasExtension( _ ByVal path As String _ ) As Boolean [C#] public static bool HasExtension( string path ); [C++] public: static bool HasExtension( String* path ); [JScript] public static function HasExtension( path : String ) : Boolean;
true if the characters that follow the last directory separator ("\\" or "/") or volume separator (":") in the path include a period ("."), false otherwise.
Exception Type | Condition |
---|---|
ArgumentException | path is empty or contains only whitespaces. |
The return value is determined by searching backwards for "." within path. If "." is matched before Environment.DirectorySeparatorChar, Environment.AltDirectorySeparatorChar, or Environment.VolumeSeparatorChar is encountered, then true is returned. Otherwise, false is returned.