Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/alf/core/org.eclipse.papyrus.uml.alf.text/src/org/eclipse/papyrus/uml/alf/text/representation/compare/StringUtil.java')
-rw-r--r--extraplugins/alf/core/org.eclipse.papyrus.uml.alf.text/src/org/eclipse/papyrus/uml/alf/text/representation/compare/StringUtil.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/extraplugins/alf/core/org.eclipse.papyrus.uml.alf.text/src/org/eclipse/papyrus/uml/alf/text/representation/compare/StringUtil.java b/extraplugins/alf/core/org.eclipse.papyrus.uml.alf.text/src/org/eclipse/papyrus/uml/alf/text/representation/compare/StringUtil.java
new file mode 100644
index 00000000000..e3120567d8d
--- /dev/null
+++ b/extraplugins/alf/core/org.eclipse.papyrus.uml.alf.text/src/org/eclipse/papyrus/uml/alf/text/representation/compare/StringUtil.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Jeremie Tatibouet
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.alf.text.representation.compare;
+
+public class StringUtil {
+
+ public static final char CHAR_EOL = '\n';
+ public static final String EOL = "\n";
+
+ /**
+ * Return true if the given string is not negligible to be used in a comparison
+ *
+ * @param str
+ * - the assessed string
+ * @return negligible
+ */
+ public static final boolean isNegligible(String str) {
+ boolean negligible = true;
+ if (!str.isEmpty()) {
+ int i = 0;
+ while (negligible && i < str.length()) {
+ if (str.charAt(i) != '\n'
+ && str.charAt(i) != '\r'
+ && str.charAt(i) != ' '
+ && str.charAt(i) != '\t') {
+ negligible = false;
+ }
+ i++;
+ }
+ }
+ return negligible;
+ }
+}

Back to the top