[chronojump] New method Util.GetExtension



commit 9e5402cfcbff321a0800187a3fa887d980004e3e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 17 13:24:49 2019 +0200

    New method Util.GetExtension

 src/util.cs | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/util.cs b/src/util.cs
index cf339f4f..4c884f05 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1914,6 +1914,16 @@ public class Util
                return myFile + extension;
        }
 
+       //this includes the '.', eg: returns ".csv"
+       public static string GetExtension(string myFile)
+       {
+               int posOfDot = myFile.LastIndexOf('.');
+               if (posOfDot > 0)
+                       return myFile.Substring(posOfDot);
+
+               return "";
+       }
+
        public static string RemoveExtension(string myFile)
        {
                int posOfDot = myFile.LastIndexOf('.');


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]