[tx-robot] updated from transifex
[pub/Android/ownCloud.git] / src / com / owncloud / android / utils / DisplayUtils.java
index cad1770..a1afb89 100644 (file)
@@ -33,6 +33,7 @@ import android.text.format.DateUtils;
 \r
 import com.owncloud.android.MainApp;\r
 import com.owncloud.android.R;\r
+import com.owncloud.android.datamodel.OCFile;\r
 \r
 /**\r
  * A helper class for some string operations.\r
@@ -319,4 +320,17 @@ public class DisplayUtils {
         \r
         return dateString.toString().split(",")[0];
     }\r
+\r
+    /**\r
+     * Update the passed path removing the last "/" if it is not the root folder\r
+     * @param path\r
+     */\r
+    public static String getPathWithoutLastSlash(String path) {\r
+\r
+        // Remove last slash from path\r
+        if (path.length() > 1 && path.charAt(path.length()-1) == OCFile.PATH_SEPARATOR.charAt(0)) {\r
+            path = path.substring(0, path.length()-1);\r
+        }\r
+        return path;\r
+    }\r
 }\r