Example usage for java.lang String concat

List of usage examples for java.lang String concat

Introduction

In this page you can find the example usage for java.lang String concat.

Prototype

public String concat(String str) 

Source Link

Document

Concatenates the specified string to the end of this string.

Usage

From source file:com.erudika.para.core.CoreUtils.java

public static String getObjectURI(ParaObject obj) {
    String defurl = "/".concat(obj.getPlural());
    return (obj.getId() != null) ? defurl.concat("/").concat(obj.getId()) : defurl;
}

From source file:com.theaigames.game.warlight2.MapCreator.java

/**
 * @param map/*from  ww w .ja v  a2  s  .c om*/
 * @return : the string representation of how given map's regions are connected
 */
private static String getNeighborsString(Map map) {
    String neighborsString = "setup_map neighbors";
    ArrayList<Point> doneList = new ArrayList<Point>();
    for (Region region : map.regions) {
        int id = region.getId();
        String neighbors = "";
        for (Region neighbor : region.getNeighbors()) {
            if (checkDoneList(doneList, id, neighbor.getId())) {
                neighbors = neighbors.concat("," + neighbor.getId());
                doneList.add(new Point(id, neighbor.getId()));
            }
        }
        if (neighbors.length() != 0) {
            neighbors = neighbors.replaceFirst(",", " ");
            neighborsString = neighborsString.concat(" " + id + neighbors);
        }
    }
    return neighborsString;
}

From source file:dhbw.clippinggorilla.external.twitter.TwitterUtils.java

/**
 * @param string/*from   w  ww. j a va  2s . c  om*/
 * @return
 *
 */
private static String replaceWhitespaces(String string) {
    String word = " OR ";
    String result = "";
    List<String> allMatches = new ArrayList<>();

    if (StringUtils.countMatches(string, '"') > 0 && ((StringUtils.countMatches(string, '"') & 1) == 1)) {
        string = string.concat("\"");
    }

    Matcher m = Pattern.compile("[^,]+").matcher(string);
    while (m.find()) {
        allMatches.add(m.group());
    }

    for (String sub : allMatches) {
        sub = sub.trim();
        result = result.concat("\"" + sub + "\"" + word);
    }

    result = result.substring(0, result.length() - 4); // remove last "OR"

    return result;
}

From source file:com.example.igorklimov.popularmoviesdemo.helpers.Utility.java

private static String concat(String to, String concat) {
    return to.concat(to.length() == 0 ? concat : ", " + concat);
}

From source file:eu.optimis.ecoefficiencytool.core.tools.ConfigManager.java

public static String getConfigFilePath(String configFile) {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = "/opt/optimis";
        log.debug("ECO: OPTIMIS_HOME: " + optimisHome + " (DEFAULT)");
    } else {//from   w  w w.j  a va2 s .com
        log.debug("ECO: OPTIMIS_HOME: " + optimisHome);
    }

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("ECO: Error reading " + optimisHome.concat(configFile) + " configuration file: "
                    + ex.getMessage());
            ex.printStackTrace();
        }
    }

    return optimisHome.concat(configFile);
}

From source file:com.microsoftopentechnologies.windowsazurestorage.helper.Utils.java

/**
 * Returns formatted blob end point in case if a non-default one is
 * specified./*from w  ww . j  a  va  2 s .  c  o m*/
 *
 * @param blobURL
 * @return DEF_BLOB_URL if blobURL is empty or blobURL is default one else
 * returns formatted blob url.
 */
public static String getBlobEP(String blobURL) {

    if (StringUtils.isBlank(blobURL)) {
        return Constants.DEF_BLOB_URL;
    }

    // Append forward slash
    if (!blobURL.endsWith(Constants.FWD_SLASH)) {
        blobURL = blobURL.concat(Constants.FWD_SLASH);
    }

    // prepend http protocol if missing
    if (!blobURL.contains(Constants.PRT_SEP)) {
        blobURL = new StringBuilder().append(Constants.HTTP_PRT).append(blobURL).toString();
    }

    return blobURL;
}

From source file:eu.optimis.infrastructureproviderriskassessmenttool.core.configration.ConfigManager.java

public static String getConfigFilePath(String configFile) {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = "/opt/optimis";
        log.debug("IPRA: OPTIMIS_HOME: " + optimisHome + " (DEFAULT)");
    } else {/*from w w w  .  j a  v a  2 s  .c om*/
        log.debug("IPRA: OPTIMIS_HOME: " + optimisHome);
    }

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("IPRA: Error reading " + optimisHome.concat(configFile) + " configuration file: "
                    + ex.getMessage());
            ex.printStackTrace();
        }
    }

    return optimisHome.concat(configFile);
}

From source file:eu.optimis.serviceproviderriskassessmenttool.core.configration.ConfigManager.java

public static String getConfigFilePath(String configFile) {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = "/opt/optimis";
        log.debug("SPRA: OPTIMIS_HOME: " + optimisHome + " (DEFAULT)");
    } else {/*from w w  w. j  a v  a2  s .c om*/
        log.debug("SPRA: OPTIMIS_HOME: " + optimisHome);
    }

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("IPRA: Error reading " + optimisHome.concat(configFile) + " configuration file: "
                    + ex.getMessage());
            ex.printStackTrace();
        }
    }

    return optimisHome.concat(configFile);
}

From source file:org.gvnix.service.roo.addon.addon.security.WSServiceSecurityMetadata.java

/**
 * Compute property file path (relative to classpath) for a serviceClass
 * //from   www. j av  a 2s.  c o m
 * @param serviceClass
 * @return
 */
public static String getPropertiesPath(JavaType serviceClass) {
    String classpath = serviceClass.getFullyQualifiedTypeName();
    String path = classpath.replace('.', '/');
    return path.concat("Security.properties");
}

From source file:com.ushahidi.android.app.util.Util.java

/**
 * joins two strings together
 * 
 * @param first
 * @param second
 * @return
 */
public static String joinString(String first, String second) {
    return first.concat(second);
}