From 0359699e221ebba2fa6cb4c6297f9874edcefcc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 10 Apr 2008 15:27:44 +0000 Subject: [PATCH] add method to encode multiple string values git-svn-id: http://trooper/svn/projects/jSite/trunk@696 c3eda9e8-030b-0410-8277-bc7414b0a119 --- src/net/pterodactylus/util/fcp/FcpUtils.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/net/pterodactylus/util/fcp/FcpUtils.java b/src/net/pterodactylus/util/fcp/FcpUtils.java index 3a5d5ba..6f599e4 100644 --- a/src/net/pterodactylus/util/fcp/FcpUtils.java +++ b/src/net/pterodactylus/util/fcp/FcpUtils.java @@ -65,4 +65,23 @@ public class FcpUtils { return encodedField.toString(); } + /** + * Encodes the given string array into a string, separating the values by + * ‘;’. + * + * @param values + * The values to encode + * @return The encoded values + */ + public static String encodeMultiStringField(String[] values) { + StringBuilder encodedField = new StringBuilder(); + for (String value: values) { + if (encodedField.length() > 0) { + encodedField.append(';'); + } + encodedField.append(value); + } + return encodedField.toString(); + } + } -- 2.7.4