C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Finally: The program shows exactly what the extension is. The period is included at the start of the three-character extension.
VB.NET program that uses Path.GetExtension
Imports System.IO
Module Module1
Sub Main()
' Input path.
Dim p As String = "C:\Users\Sam\Documents\Test.txt"
' Get extension.
Dim extension As String = Path.GetExtension(p)
' Display extension.
Console.WriteLine(extension)
Console.WriteLine(".txt" = extension)
End Sub
End Module
Output
.txt
True