Example usage for java.lang Character toString

List of usage examples for java.lang Character toString

Introduction

In this page you can find the example usage for java.lang Character toString.

Prototype

public static String toString(int codePoint) 

Source Link

Document

Returns a String object representing the specified character (Unicode code point).

Usage

From source file:correospingtelnet.CorreosPingTelnet.java

private static boolean verificarPing(String ip) throws Exception {
    final IcmpPingRequest request = IcmpPingUtil.createIcmpPingRequest();
    request.setHost(ip);/*from  ww w . j ava 2 s .c o m*/

    // delegate
    final IcmpPingResponse response = IcmpPingUtil.executePingRequest(request);

    // log
    final String formattedResponse = IcmpPingUtil.formatResponse(response);
    System.out.println(formattedResponse);
    //Aqu tomaremos el valor de los ms y los guardaremos en un arreglo. 
    String[] splitStr = formattedResponse.split("\\s+");
    int valor = 0;
    if (splitStr.length > 5) {
        //Quitamos los ms
        char[] cadenaEnChars = splitStr[4].toCharArray();
        if (cadenaEnChars.length == 8) {
            valor = Integer.parseInt(Character.toString(cadenaEnChars[5]));
        } else {
            valor = Integer
                    .parseInt(Character.toString(cadenaEnChars[5]) + Character.toString(cadenaEnChars[6]));
        }
        return true;

    } else {
        //Aqu hacer telnet
        //Aqu enviar correo             
        return false;

    }

}

From source file:cc.recommenders.io.Directory.java

public Directory(String rootDir) {
    String pathSep = Character.toString(File.separatorChar);
    if (rootDir.endsWith(pathSep)) {
        this.rootDir = rootDir;
    } else {/*  w ww  .  ja va 2 s  .  co  m*/
        this.rootDir = rootDir + pathSep;
    }

    File rootFile = new File(rootDir);
    Asserts.assertFalse(rootFile.isFile(), "unable to create directory (is file)");
    if (!rootFile.isDirectory()) {
        rootFile.mkdirs();
        if (!rootFile.isDirectory()) {
            Asserts.fail("unable to create directory");
        }
    }
}

From source file:com.intuit.tank.vm.common.util.ValidationUtil.java

private static final String removeIdentifier(String key, char c) {
    if (key.charAt(0) == c) {
        key = key.replaceFirst(Character.toString(c), "");
    }/*from  w  ww. ja  va  2  s.  co  m*/
    return key;
}

From source file:net.sourceforge.vulcan.spring.jdbc.MetricInserter.java

public int insert(int buildId, List<MetricDto> metrics) {
    int count = 0;

    final Object[] params = new Object[4];

    params[0] = buildId;/*from   w w  w . j  av a 2s. c  o  m*/

    for (MetricDto dto : metrics) {
        params[1] = dto.getMessageKey();
        params[2] = Character.toString(dto.getType().getId());
        params[3] = dto.getValue();

        count += update(params);
    }

    return count;
}

From source file:com.ancientprogramming.fixedformat4j.format.impl.CharacterFormatter.java

public String asString(Character obj, FormatInstructions instructions) {
    String result = "";
    if (obj != null) {
        result = Character.toString(obj);
    }//ww w .j  a va 2 s . c o  m
    return result;
}

From source file:com.callidusrobotics.object.ItemData.java

public ItemData(final String identifier, final char character, final TrueColor foreground,
        final InventoriableData inventoriableData, final UseableData useableData,
        final EquipableData equipableData) {
    this.identifier = identifier;
    this.character = Character.toString(character);
    this.color = foreground.toString();
    this.inventoriableData = inventoriableData;
    this.useableData = useableData;
    this.equipableData = equipableData;
}

From source file:edu.eci.arsw.pacm.services.PacmServicesStub.java

@Override
public void registrarJugadorProtector(int salanum, Player p) throws ServicesException {
    if (!salasData.containsKey(salanum)) {
        throw new ServicesException("Sala " + salanum + " no ha sido registrada en el servidor.");
    } else {/*from w w  w  .  j  a v  a 2 s  .  c o m*/
        CopyOnWriteArrayList tmp = salasData.get(salanum).getProtectores();
        int a = 96 + tmp.size();
        identifacadores.put(p.getNombre(), Character.toString((char) a));
        tmp.add(p);
        salasData.get(salanum).setProtectores(tmp);
    }
}

From source file:com.google.code.configprocessor.processing.properties.model.PropertyMapping.java

public void parse(String text, boolean trim) {
    String[] splitted = StringUtils.splitPreserveAllTokens(text, SEPARATOR_1 + SEPARATOR_2, 2);

    if (splitted.length > 1) {
        String name = splitted[0];
        String value = splitted[1];
        while (StringUtils.endsWith(name, SEPARATOR_ESCAPE)) {
            String[] aux = StringUtils.splitPreserveAllTokens(value, SEPARATOR_1 + SEPARATOR_2, 2);
            String charToAdd = Character.toString(text.charAt(name.length()));
            name += charToAdd;//w  w  w. ja  va  2 s.c  o  m
            if (aux.length > 1) {
                name += aux[0];
                value = aux[1];
            } else if ((charToAdd.equals(SEPARATOR_1)) || (charToAdd.equals(SEPARATOR_2))) {
                name += value;
                value = null;
            } else {
                value = aux[0];
            }
        }

        splitted[0] = name;
        splitted[1] = value;
    }

    if (trim) {
        propertyName = splitted[0].trim();
    } else {
        propertyName = splitted[0];
    }

    if (splitted.length == 1) {
        propertyValue = null;
    } else {
        propertyValue = splitted[1];
    }
}

From source file:de.tudarmstadt.ukp.dkpro.core.ngrams.util.CharacterNGramStringIterable.java

private List<String> createNGramList(String token, int minN, int maxN) {
    if (minN > maxN) {
        throw new IllegalArgumentException("minN needs to be smaller or equal than maxN.");
    }/*from ww  w.j a  va2  s.  com*/

    List<String> nGrams = new ArrayList<String>();

    // fill character list
    List<String> charList = new ArrayList<String>();
    for (char c : token.toCharArray()) {
        charList.add(Character.toString(c));
    }

    for (int k = minN; k <= maxN; k++) {
        // if the number of tokens is less than k => break
        if (charList.size() < k) {
            break;
        }
        nGrams.addAll(getNGrams(charList, k));
    }

    return nGrams;
}

From source file:com.h6ah4i.android.example.advrecyclerview.common.data.ExampleExpandableDataProvider.java

public ExampleExpandableDataProvider() {
    final String groupItems = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    final String childItems = "abc";

    mData = new LinkedList<>();

    for (int i = 0; i < groupItems.length(); i++) {
        //noinspection UnnecessaryLocalVariable
        final long groupId = i;
        final String groupText = Character.toString(groupItems.charAt(i));
        final ConcreteGroupData group = new ConcreteGroupData(groupId, groupText);
        final List<ChildData> children = new ArrayList<>();

        for (int j = 0; j < childItems.length(); j++) {
            final long childId = group.generateNewChildId();
            final String childText = Character.toString(childItems.charAt(j));

            children.add(new ConcreteChildData(childId, childText));
        }/*from   w  ww.  j a v  a 2 s  .com*/

        mData.add(new Pair<GroupData, List<ChildData>>(group, children));
    }
}