From: <me...@us...> - 2010-01-19 09:53:36
|
Revision: 1679 http://openutils.svn.sourceforge.net/openutils/?rev=1679&view=rev Author: memila Date: 2010-01-19 09:53:27 +0000 (Tue, 19 Jan 2010) Log Message: ----------- input parameter descrptions added to both tld and java files Modified Paths: -------------- trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld Modified: trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java =================================================================== --- trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java 2010-01-18 17:59:05 UTC (rev 1678) +++ trunk/openutils-elfunctions/src/main/java/net/sourceforge/openutils/elfunctions/ElStringUtils.java 2010-01-19 09:53:27 UTC (rev 1679) @@ -61,14 +61,25 @@ { return "\n"; } - + /** + * Escapes a javascript string. If "true" is passed as parameter, the string is between ", if false is bewteen ' + * @param String text - the string to be escaped + * @param boolean dbl - If "true" the escaped string is returned between ", if false is returned bewteen ' + * @return the escaped string between either ' or " + */ public static String escapeJsText(String text, boolean dbl) { String repl = dbl ? "\"" : "'"; String with = "\\" + repl; return repl + (text != null ? StringUtils.replace(text, repl, with) : "") + repl; } - + /** + * Crops a String to a given length, adding a suffix if needed. + * @param java.lang.String value- The string to be adapted + * @param int maxLength - The number of chars of the string to be kept + * @param java.lang.String ellipses - The suffix to be added if the string is not complete + * @return adapeted String + */ public static String adaptStringLength(String value, int maxLength, String ellipses) { if (value != null && value.length() > maxLength) @@ -78,7 +89,11 @@ return value; } - + /** + * Strip any html tag from a String. + * @param java.lang.String - The string to be stripped + * @return stripped String + */ public static String stripHtmlTags(String string) { if (StringUtils.isNotBlank(string)) @@ -180,12 +195,12 @@ } /** - * Shorten a text with a number of lines and a number of chars per line to be displayed. Display ellipses the line - * is shortened. - * @param text original text - * @param lines number of lines - * @param numOfCharsPerLine number of chars per line - * @param ellipses ellipses ('...') + * Shorten a text with a number of lines and a number of chars per line to be displayed. Display optional ellipses where the + * line is shortened. + * @param String text original text + * @param int lines number of lines + * @param int numOfCharsPerLine number of chars per line + * @param String ellipses optional ellipses ('...') to display optional ellipses where the line is shortened. * @return cropped string */ public static String shorten(String text, int lines, int numOfCharsPerLine, String ellipses) Modified: trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld =================================================================== --- trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld 2010-01-18 17:59:05 UTC (rev 1678) +++ trunk/openutils-elfunctions/src/main/resources/META-INF/stringutils.tld 2010-01-19 09:53:27 UTC (rev 1679) @@ -67,16 +67,30 @@ <function-signature>java.lang.String newline()</function-signature> </function> <function> - <description>Escapes a javascript string.</description> + <description>Escapes a javascript string. If "true" is passed as parameter, the string is between ", if false is bewteen '</description> <name>escJsTxt</name> <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> <function-signature>java.lang.String escapeJsText(java.lang.String, boolean)</function-signature> + <example> + <![CDATA[ + escJsTxt("xyz\\23",true) : "xyz\23" + ]]> + </example> </function> <function> - <description>Crops a String to a given length, adding a suffix (for example "...") if needed.</description> + <description>Crops a String to a given length, adding a suffix (for example "...") if needed. The function accept 3 parameters: + <![CDATA[<br/><strong>java.lang.String:</strong> The string to be adapted<br/> + <strong>int:</strong> The number of chars of the string to be kept<br/> + <strong>java.lang.String:</strong> The suffix to be added if the string is not complete + ]]></description> <name>adaptStringLength</name> <function-class>net.sourceforge.openutils.elfunctions.ElStringUtils</function-class> <function-signature>java.lang.String adaptStringLength(java.lang.String, int, java.lang.String)</function-signature> + <example> + <![CDATA[ + adaptStringLength("pre",2,"post") : prpost + ]]> + </example> </function> <function> <description>Strip any html tag from a String.</description> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |