All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.payneteasy.superfly.client.PrefixRemovingTransformer Maven / Gradle / Ivy

There is a newer version: 1.7-32
Show newest version
package com.payneteasy.superfly.client;

/**
 * Transformer which removes a matching prefix if finds one.
 * 
 * @author Roman Puchkovskiy
 */
public class PrefixRemovingTransformer implements StringTransformer {

    private String[] prefixes = {};

    public void setPrefixes(String[] prefixes) {
        this.prefixes = prefixes;
    }

    public String transform(String s) {
        for (String prefix : prefixes) {
            if (s.startsWith(prefix)) {
                s = s.substring(prefix.length());
            }
        }
        return s;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy