Extract file extension: Difference between revisions
Content deleted Content added
Improved C# implementation |
Added C# implementation using Regex |
||
Line 347: | Line 347: | ||
break; |
break; |
||
} |
} |
||
//The dot must be followed by at least one other character, |
|||
⚫ | |||
//so if the last character is a dot, return the empty string |
|||
⚫ | |||
}</lang> |
}</lang> |
||
'''Using regular expressions (C# 6)''' |
|||
<lang [[C sharp|C#]]>public static string FindExtension(string filename) => Regex.Match(filename, @"\.[A-Za-z0-9]+$").Value;</lang> |
|||
=={{header|Emacs Lisp}}== |
=={{header|Emacs Lisp}}== |