[Tynstep-svn] r163 - trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/utils

ChrisBurrell at crosswire.org ChrisBurrell at crosswire.org
Sat Jul 31 02:30:39 MST 2010


Author: ChrisBurrell
Date: 2010-07-31 02:30:39 -0700 (Sat, 31 Jul 2010)
New Revision: 163

Added:
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/utils/OsisUtils.java
Log:
commiting fix to remove unecessary compile files causing assembler to overwrite gwtp compilation

Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/utils/OsisUtils.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/utils/OsisUtils.java	                        (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/utils/OsisUtils.java	2010-07-31 09:30:39 UTC (rev 163)
@@ -0,0 +1,42 @@
+package com.tyndalehouse.step.web.client.framework.utils;
+
+import static com.tyndalehouse.step.web.client.framework.utils.StringUtils.isEmpty;
+
+/**
+ * Some helper functions for Osis parsing
+ * 
+ * @author CJBurrell
+ * 
+ */
+public class OsisUtils {
+    private static final char OSIS_REFERENCE_SEPARATOR = '.';
+
+    /**
+     * hiding implementation
+     */
+    private OsisUtils() {
+        // no implementation
+    }
+
+    /**
+     * give an osisID, we extract and return the verse number
+     * 
+     * @param osisId
+     *            the osis id
+     * @return the verse number
+     */
+    public static String getVerseNumberFromOsisId(final String osisId) {
+        if (isEmpty(osisId)) {
+            return "";
+        }
+
+        // assume we have at just two '.'
+        final int firstIndex = osisId.indexOf(OSIS_REFERENCE_SEPARATOR) + 1;
+        final int lastOsisPart = osisId.lastIndexOf(OSIS_REFERENCE_SEPARATOR) + 1;
+        if (lastOsisPart > osisId.length() || firstIndex == lastOsisPart) {
+            return "";
+        }
+
+        return osisId.substring(lastOsisPart);
+    }
+}




More information about the Tynstep-svn mailing list