Example usage for java.lang String copyValueOf

List of usage examples for java.lang String copyValueOf

Introduction

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

Prototype

public static String copyValueOf(char data[], int offset, int count) 

Source Link

Document

Equivalent to #valueOf(char[],int,int) .

Usage

From source file:org.talend.component.core.model.Component.java

@Override
public String getShortName() {
    String originalComponentName = getName();
    String calculatedShortName = "";//$NON-NLS-1$
    char[] cars = new char[originalComponentName.length()];
    int nbChars = 0;

    for (int i = 0; i < originalComponentName.length(); i++) {
        for (char c = 'A'; c <= 'Z'; c++) {
            if (originalComponentName.charAt(i) == c) {
                cars[nbChars] = originalComponentName.charAt(i);
                nbChars++;/* w w w.  j  a  v a 2  s . c  om*/
            }
        }
    }
    calculatedShortName = String.copyValueOf(cars, 0, nbChars);
    calculatedShortName = calculatedShortName.toLowerCase();
    return calculatedShortName;
}

From source file:org.talend.designer.core.model.components.EmfComponent.java

@Override
public String getShortName() {
    if (compType == null) {
        isLoaded = false;/*from   w w  w .ja  v a  2s .  c o  m*/
        try {
            load();
        } catch (BusinessException e) {
            // TODO Auto-generated catch block
            ExceptionHandler.process(e);
        }
    }
    if (!StringUtils.isEmpty(compType.getHEADER().getSHORTNAME())) {
        return compType.getHEADER().getSHORTNAME();
    } else {
        String originalComponentName = getName();
        String calculatedShortName = ""; //$NON-NLS-1$
        char[] cars = new char[originalComponentName.length()];
        int nbChars = 0;

        for (int i = 0; i < originalComponentName.length(); i++) {
            for (char c = 'A'; c <= 'Z'; c++) {
                if (originalComponentName.charAt(i) == c) {
                    cars[nbChars] = originalComponentName.charAt(i);
                    nbChars++;
                }
            }
        }
        calculatedShortName = String.copyValueOf(cars, 0, nbChars);
        calculatedShortName = calculatedShortName.toLowerCase();
        return calculatedShortName;
    }
}