Skip to content

Commit

Permalink
SAK-40431 strip line breaks from gradebook item name (sakaiproject#5867)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored and steveswinsburg committed Aug 14, 2018
1 parent 59cce2a commit 19939c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ public static String formatDateTime(final Date date) {
return df.format(date);
}

/**
* Strips out line breaks
*
* @param s String to abbreviate
* @return string without line breaks
*/
public static String stripLineBreaks(final String s) {
return s.replaceAll("\\r\\n|\\r|\\n", "");
}

/**
* Abbreviate a string via {@link StringUtils#abbreviateMiddle(String, String, int)}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ private List<ColumnDefinition> loadColumns(final List<Assignment> assignments) {
counted = false;
}
result.add(new AssignmentDefinition(a1.getId(),
a1.getName(),
FormatHelper.stripLineBreaks(a1.getName()),
FormatHelper.abbreviateMiddle(a1.getName()),
FormatHelper.formatDoubleToDecimal(a1.getPoints()),
FormatHelper.formatDate(a1.getDueDate(), getString("label.studentsummary.noduedate")),
Expand Down

0 comments on commit 19939c9

Please sign in to comment.