From: David ‘Bombe’ Roden Date: Thu, 10 Apr 2008 15:27:44 +0000 (+0000) Subject: add method to encode multiple string values X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0359699e221ebba2fa6cb4c6297f9874edcefcc3;p=jSite2.git add method to encode multiple string values git-svn-id: http://trooper/svn/projects/jSite/trunk@696 c3eda9e8-030b-0410-8277-bc7414b0a119 --- 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(); + } + }