|
From: Eric P. <th...@us...> - 2011-08-01 23:47:28
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util
In directory vz-cvs-3.sog:/tmp/cvs-serv15500
Modified Files:
StringUtil.java
Log Message:
Added ellipsis utility method.
Index: StringUtil.java
===================================================================
RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/StringUtil.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** StringUtil.java 9 Mar 2011 17:31:19 -0000 1.44
--- StringUtil.java 1 Aug 2011 23:47:25 -0000 1.45
***************
*** 1457,1460 ****
--- 1457,1472 ----
/**
+ * Return a substring of the source that is at most lenmax chars
+ * long including ellipsis if necessary.
+ */
+ public static String ellipsis(int lenmax,String source)
+ {
+ if((!haveValue(source))||(source.length()<=lenmax)) {
+ return source; }
+ return source.substring(0,lenmax-3) + "...";
+ }
+
+
+ /**
* Wrap the given string so there are no more than maxCharsPerLine
* without a terminating newline string.
|