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:net.sourceforge.fenixedu.domain.degreeStructure.EctsComparabilityTable.java

public String convert(int grade) {
    if (grade < 10 || grade > 20) {
        throw new DomainException("error.degreeStructure.converting.grade.not.in.approval.range");
    }/*from  ww  w. j a  v a 2s  .com*/
    return Character.toString(table[grade - 10]);
}

From source file:org.exoplatform.wiki.rendering.internal.parser.confluence.ConfluenceLinkReferenceParser.java

public static String divideOn(StringBuffer buffer, char divider) {
    if (buffer.length() == 0) {
        return null;
    }/*from w  w  w.ja  v a 2  s.c  om*/
    int i = buffer.indexOf(Character.toString(divider));

    if (i < 0) {
        return null;
    }
    if (i == 0) {
        buffer.deleteCharAt(0);
        return null;
    }

    String body = buffer.substring(0, i);
    buffer.delete(0, i + 1);
    return body;
}

From source file:Main.java

public static HashMap<Integer, String> newDictLZW(String inMsg) {
    HashMap<Integer, String> dict = new HashMap<Integer, String>();
    int j = 0;// ww w  . j a v  a2 s  . c o m

    for (int i = 0; i < inMsg.length(); i++) {
        if (dict.containsValue(Character.toString(inMsg.charAt(i))) == false && inMsg.charAt(i) != '\n') {
            dict.put((Integer) j, Character.toString(inMsg.charAt(i)));
            j++;
        }
    }
    return dict;
}

From source file:com.ibm.soatf.tool.Utils.java

public static String escapeRegexChars(String str) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < str.length(); i++) {
        char c = str.charAt(i);
        final String c2Str = Character.toString(c);
        if (regexChars.contains(c2Str)) {
            sb.append("\\");
        }//ww  w . j  ava2  s  .  c o  m
        sb.append(c2Str);
    }
    return sb.toString();
}

From source file:ml.shifu.shifu.core.binning.EqualPopulationBinningTest.java

@Test
public void testBinning() {
    Random rd = new Random(System.currentTimeMillis());

    EqualPopulationBinning binning = new EqualPopulationBinning(10);
    long start = System.currentTimeMillis();
    for (int i = 0; i < 100000; i++) {
        binning.addData(Integer.toString(rd.nextInt() % 1000));
    }//from   w  w  w. j a va  2  s  . com
    long end = System.currentTimeMillis();
    System.out.println("Spend " + (end - start) + " milli-seconds to create data.");
    System.out.println(binning.getDataBin());

    String binStr = binning.objToString();
    String[] fieldArr = binStr.split(Character.toString(AbstractBinning.FIELD_SEPARATOR));
    Assert.assertTrue(fieldArr.length == 6);
}

From source file:bulat.diet.helper_couch.common.data.ExampleSectionExpandableDataProvider.java

public ExampleSectionExpandableDataProvider() {
    final String groupItems = "|ABC|DEF|GHI|JKL|MNO|PQR|STU|VWX|YZ";
    final String childItems = "abc";

    mData = new LinkedList<>();

    int sectionCount = 1;

    for (int i = 0; i < groupItems.length(); i++) {
        //noinspection UnnecessaryLocalVariable
        final long groupId = i;
        final boolean isSection = (groupItems.charAt(i) == '|');
        final String groupText = isSection ? ("Section " + sectionCount)
                : Character.toString(groupItems.charAt(i));
        final ConcreteGroupData group = new ConcreteGroupData(groupId, isSection, groupText);
        final List<ChildData> children = new ArrayList<>();

        if (isSection) {
            sectionCount += 1;/*  ww  w. j ava  2  s . c o m*/
        } else {
            // add child items
            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));
            }
        }

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

From source file:com.igormaznitsa.zxpspritecorrector.files.FileNameDialog.java

private void processZxFileType(final JTextField field, final char[] array, final int index) {
    if (array == null || array[index] == 0) {
        field.setEnabled(false);//from   w  w  w .java  2 s . c  o m
    } else {
        field.setText(Character.toString(array[index]));
    }
}

From source file:com.itude.mobile.mobbl.core.util.StringUtilities.java

public static String stripCharacter(String inputString, char stripCharacter) {
    return inputString.replaceAll(Pattern.quote(Character.toString(stripCharacter)), "");
}

From source file:com.admc.jcreole.marker.BufferMarker.java

public String getMarkerString() {
    return Character.toString(markerChar) + getIdString();
}

From source file:de.haber.xmind2latex.cli.CliParameters.java

/**
 * Helper method that throws a {@link ParseException} if parameter arguments are missing.
 * //w ww. j av a2 s  .c  o  m
 * @param cmd the concrete {@link CommandLine}
 * @param param name of the parameter that is to be validated
 * @param opts configured {@link Options}
 * @throws ParseException if the number of arguments does not correspond to the expected number of arguments for the given parameter
 */
public static void validateNumberOfArguments(CommandLine cmd, char param, Options opts) throws ParseException {
    Integer numberOfArgs = param2arguments.get(param);
    String[] tmp = cmd.getOptionValues(param);
    if (numberOfArgs != null && tmp != null && tmp.length % numberOfArgs != 0) {
        Option o = opts.getOption(Character.toString(param));
        String name = o.getLongOpt() != null ? o.getLongOpt() : Character.toString(param);
        throw new ParseException("Invalid amount of arguments for parameter " + name + ": <" + o.getArgName()
                + ">. Description: " + o.getDescription());
    }
}