add method to encode multiple string values
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 10 Apr 2008 15:27:44 +0000 (15:27 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 10 Apr 2008 15:27:44 +0000 (15:27 +0000)
git-svn-id: http://trooper/svn/projects/jSite/trunk@696 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/util/fcp/FcpUtils.java

index 3a5d5ba..6f599e4 100644 (file)
@@ -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();
+       }
+
 }