|
From: <caw...@us...> - 2007-03-16 13:49:21
|
Revision: 2193
http://svn.sourceforge.net/rubyeclipse/?rev=2193&view=rev
Author: cawilliams
Date: 2007-03-16 06:49:20 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/Strings.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/Strings.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/Strings.java 2007-03-16 13:39:20 UTC (rev 2192)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/Strings.java 2007-03-16 13:49:20 UTC (rev 2193)
@@ -82,4 +82,23 @@
return ch == '\n' || ch == '\r';
}
+ /**
+ * Returns <code>true</code> if the given string only consists of
+ * white spaces according to Ruby. If the string is empty, <code>true
+ * </code> is returned.
+ *
+ * @return <code>true</code> if the string only consists of white
+ * spaces; otherwise <code>false</code> is returned
+ *
+ * @see java.lang.Character#isWhitespace(char)
+ */
+ public static boolean containsOnlyWhitespaces(String s) {
+ int size= s.length();
+ for (int i= 0; i < size; i++) {
+ if (!Character.isWhitespace(s.charAt(i)))
+ return false;
+ }
+ return true;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|