diff options
Diffstat (limited to 'plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java')
-rw-r--r-- | plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java index bb20a39cd..604c8af4a 100644 --- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java +++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java @@ -684,4 +684,19 @@ public class Utils .replace( "\\5C", "\\" ) //$NON-NLS-1$ //$NON-NLS-2$ .replace( "\\5c", "\\" ); //$NON-NLS-1$ //$NON-NLS-2$ } + + + /** + * Encodes the RFC 4517 Postal Address syntax. + * + * @param input the string to encode + * @param separator the separator used between address lines + * @return the encoded string + */ + public static String encodePostalAddress( String input, String separator ) + { + return input.replace( "\\", "\\5C" ) //$NON-NLS-1$ //$NON-NLS-2$ + .replace( "$", "\\24" ) //$NON-NLS-1$ //$NON-NLS-2$ + .replace( separator, "$" ); //$NON-NLS-1$ + } } |