aboutsummaryrefslogtreecommitdiff
path: root/server-core/src/main/java/com/juick/util
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-14 04:17:13 +0700
committerGravatar Alexander Alexeev2016-11-14 04:17:13 +0700
commitd785972dd9801ac2a3c8301b05bc2d38bd56b221 (patch)
tree07b6566df7ed24dbe5ef2a93961b477b1a7e2d17 /server-core/src/main/java/com/juick/util
parentf3de17fa7152ccc7637709835a49a0a1baaa611e (diff)
formatCode() moved to MessageUtils
Diffstat (limited to 'server-core/src/main/java/com/juick/util')
-rw-r--r--server-core/src/main/java/com/juick/util/MessageUtils.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/server-core/src/main/java/com/juick/util/MessageUtils.java b/server-core/src/main/java/com/juick/util/MessageUtils.java
new file mode 100644
index 00000000..1e8165c3
--- /dev/null
+++ b/server-core/src/main/java/com/juick/util/MessageUtils.java
@@ -0,0 +1,24 @@
+package com.juick.util;
+
+/**
+ * Created by aalexeev on 11/13/16.
+ */
+public class MessageUtils {
+ private MessageUtils() {
+ throw new IllegalStateException();
+ }
+
+ public static String formatQuote(final String quote) {
+ String result = quote;
+
+ if (quote != null) {
+ if (quote.length() > 50) {
+ result = ">" + quote.substring(0, 47).replace('\n', ' ') + "...\n";
+ } else if (!quote.isEmpty()) {
+ result = ">" + quote.replace('\n', ' ') + "\n";
+ }
+ }
+
+ return result;
+ }
+}