PathUtil.SafeGetExtension(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Return the extension of the specified path string. This always returns a non-null string for the extension. It will return Empty if:
* <code data-dev-comment-type="paramref">path</code> is null
* <code data-dev-comment-type="paramref">path</code> is empty
* <code data-dev-comment-type="paramref">path</code> does not contain an extension
Otherwise, path
's extension (including the period ".").
public:
static System::String ^ SafeGetExtension(System::String ^ path);
public:
static Platform::String ^ SafeGetExtension(Platform::String ^ path);
static std::wstring SafeGetExtension(std::wstring const & path);
public static string SafeGetExtension (string path);
static member SafeGetExtension : string -> string
Public Function SafeGetExtension (path As String) As String
Parameters
- path
- String
The path from which to get the extension
Returns
The extension, or Empty if the extension could be not obtained
Remarks
This always returns a non-null string for the extension. It will return the empty string if:
path
is nullpath
contains invalid path characterspath
is emptypath
does not contain an extension
Otherwise, path
's extension (including the period ".").