Java Properties Get getPropertiesWithPrefix(Properties pro, String prefix)

Here you can find the source of getPropertiesWithPrefix(Properties pro, String prefix)

Description

get Properties With Prefix

License

Open Source License

Declaration

static public Properties getPropertiesWithPrefix(Properties pro,
            String prefix) 

Method Source Code

//package com.java2s;
//  it under the terms of the GNU Lesser General Public License as published by

import java.util.*;

public class Main {
    static public Properties getPropertiesWithPrefix(Properties pro,
            String prefix) {//from  ww w  .jav  a  2  s  .  com
        Enumeration en;
        Properties aux = new Properties();

        en = pro.propertyNames();

        for (; en.hasMoreElements();) {
            String nom = (String) en.nextElement();

            if (nom.startsWith(prefix)) {

                aux.setProperty(nom.substring(prefix.length()),
                        pro.getProperty(nom));
            }
        }

        return aux;
    }
}

Related

  1. getLocalizedProperties(String[] propertyKeys, Properties properties)
  2. getLong(Properties props, String string, long defaultV)
  3. getNestedProperties(String prefix, Properties properties)
  4. getProp(Properties props, String name)
  5. getPropertiesForBloomFilter( int requiredFieldsSize, int matchKeySize)
  6. getProperty(Properties properties, String context, String key, String def)
  7. getProperty(Properties props, String keyword)
  8. getProperty(Properties props, String prefix, String key)
  9. getProperty(Properties props, String propertyName)