diff --git a/projects/samskivert/src/java/com/samskivert/velocity/StringTool.java b/projects/samskivert/src/java/com/samskivert/velocity/StringTool.java index 72d2df92..a1103ab4 100644 --- a/projects/samskivert/src/java/com/samskivert/velocity/StringTool.java +++ b/projects/samskivert/src/java/com/samskivert/velocity/StringTool.java @@ -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; }