Added a method for generating an always up to date copyright blurb. This is
only useful for webapps, but it's one less thing to update every damned year. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1722 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
package com.samskivert.velocity;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.samskivert.servlet.util.HTMLUtil;
|
||||
import com.samskivert.util.StringUtil;
|
||||
@@ -129,6 +130,17 @@ public class StringTool
|
||||
return StringUtil.join(values, sep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a copyright string for the specified copyright holder from the
|
||||
* specified first year to the current year.
|
||||
*/
|
||||
public static String copyright (String holder, int startYear)
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int year = cal.get(Calendar.YEAR);
|
||||
return "© " + holder + " " + startYear + "-" + year;
|
||||
}
|
||||
|
||||
/** For formatting percentages. */
|
||||
protected NumberFormat _percFormat;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user