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:com.linkedin.pinot.core.segment.creator.impl.SegmentColumnarIndexCreator.java

void writeMetadata() throws ConfigurationException {
    PropertiesConfiguration properties = new PropertiesConfiguration(
            new File(file, V1Constants.MetadataKeys.METADATA_FILE_NAME));

    properties.setProperty(SEGMENT_CREATOR_VERSION, config.getCreatorVersion());
    properties.setProperty(SEGMENT_PADDING_CHARACTER,
            StringEscapeUtils.escapeJava(Character.toString(config.getPaddingCharacter())));
    properties.setProperty(SEGMENT_NAME, segmentName);
    properties.setProperty(TABLE_NAME, config.getTableName());
    properties.setProperty(DIMENSIONS, config.getDimensions());
    properties.setProperty(METRICS, config.getMetrics());
    properties.setProperty(TIME_COLUMN_NAME, config.getTimeColumnName());
    properties.setProperty(TIME_INTERVAL, "not_there");
    properties.setProperty(SEGMENT_TOTAL_RAW_DOCS, String.valueOf(totalRawDocs));
    properties.setProperty(SEGMENT_TOTAL_AGGREGATE_DOCS, String.valueOf(totalAggDocs));
    properties.setProperty(SEGMENT_TOTAL_DOCS, String.valueOf(totalDocs));
    properties.setProperty(STAR_TREE_ENABLED, String.valueOf(config.isEnableStarTreeIndex()));
    properties.setProperty(SEGMENT_TOTAL_ERRORS, String.valueOf(totalErrors));
    properties.setProperty(SEGMENT_TOTAL_NULLS, String.valueOf(totalNulls));
    properties.setProperty(SEGMENT_TOTAL_CONVERSIONS, String.valueOf(totalConversions));
    properties.setProperty(SEGMENT_TOTAL_NULL_COLS, String.valueOf(totalNullCols));

    StarTreeIndexSpec starTreeIndexSpec = config.getStarTreeIndexSpec();
    if (starTreeIndexSpec != null) {
        properties.setProperty(STAR_TREE_SPLIT_ORDER, starTreeIndexSpec.getDimensionsSplitOrder());
        properties.setProperty(STAR_TREE_MAX_LEAF_RECORDS, starTreeIndexSpec.getMaxLeafRecords());
        properties.setProperty(STAR_TREE_SKIP_STAR_NODE_CREATION_FOR_DIMENSIONS,
                starTreeIndexSpec.getSkipStarNodeCreationForDimensions());
        properties.setProperty(STAR_TREE_SKIP_MATERIALIZATION_CARDINALITY,
                starTreeIndexSpec.getskipMaterializationCardinalityThreshold());
        properties.setProperty(STAR_TREE_SKIP_MATERIALIZATION_FOR_DIMENSIONS,
                starTreeIndexSpec.getskipMaterializationForDimensions());
    }//from w  w  w.  ja v a  2s.  co m

    HllConfig hllConfig = config.getHllConfig();
    Map<String, String> derivedHllFieldToOriginMap = null;
    if (hllConfig != null) {
        properties.setProperty(SEGMENT_HLL_LOG2M, hllConfig.getHllLog2m());
        derivedHllFieldToOriginMap = hllConfig.getDerivedHllFieldToOriginMap();
    }

    String timeColumn = config.getTimeColumnName();
    if (indexCreationInfoMap.get(timeColumn) != null) {
        properties.setProperty(SEGMENT_START_TIME, indexCreationInfoMap.get(timeColumn).getMin());
        properties.setProperty(SEGMENT_END_TIME, indexCreationInfoMap.get(timeColumn).getMax());
        properties.setProperty(TIME_UNIT, config.getSegmentTimeUnit());
    }

    if (config.containsCustomProperty(SEGMENT_START_TIME)) {
        properties.setProperty(SEGMENT_START_TIME, config.getStartTime());
    }
    if (config.containsCustomProperty(SEGMENT_END_TIME)) {
        properties.setProperty(SEGMENT_END_TIME, config.getEndTime());
    }
    if (config.containsCustomProperty(TIME_UNIT)) {
        properties.setProperty(TIME_UNIT, config.getSegmentTimeUnit());
    }

    for (Map.Entry<String, String> entry : config.getCustomProperties().entrySet()) {
        properties.setProperty(entry.getKey(), entry.getValue());
    }

    for (Map.Entry<String, ColumnIndexCreationInfo> entry : indexCreationInfoMap.entrySet()) {
        String column = entry.getKey();
        ColumnIndexCreationInfo columnIndexCreationInfo = entry.getValue();
        int dictionaryElementSize = dictionaryCreatorMap.get(column).getStringColumnMaxLength();

        // TODO: after fixing the server-side dependency on HAS_INVERTED_INDEX and deployed, set HAS_INVERTED_INDEX properly
        // The hasInvertedIndex flag in segment metadata is picked up in ColumnMetadata, and will be used during the query
        // plan phase. If it is set to false, then inverted indexes are not used in queries even if they are created via table
        // configs on segment load. So, we set it to true here for now, until we fix the server to update the value inside
        // ColumnMetadata, export information to the query planner that the inverted index available is current and can be used.
        //
        //    boolean hasInvertedIndex = invertedIndexCreatorMap.containsKey();
        boolean hasInvertedIndex = true;

        String hllOriginColumn = null;
        if (derivedHllFieldToOriginMap != null) {
            hllOriginColumn = derivedHllFieldToOriginMap.get(column);
        }

        addColumnMetadataInfo(properties, column, columnIndexCreationInfo, totalDocs, totalRawDocs,
                totalAggDocs, schema.getFieldSpecFor(column), dictionaryElementSize, hasInvertedIndex,
                hllOriginColumn);
    }

    properties.save();
}

From source file:org.egov.infra.utils.NumberToWord.java

private static String paiseInWords(String paise) {

    Long subNum;//from   ww  w  .j a va2 s . c  o  m
    StringBuilder returnValue = new StringBuilder();

    if (paise.length() >= 2) {
        subNum = Long.parseLong(Character.toString(paise.charAt(0)) + paise.charAt(1));
    } else {
        subNum = Long.parseLong(Character.toString(paise.charAt(0)));
    }

    if (subNum >= 21 && (subNum % 10) != 0) {
        returnValue.append(getWord(Long.parseLong(Character.toString(paise.charAt(0))) * 10)).append(WHITESPACE)
                .append(getWord(subNum % 10));

    } else {
        returnValue.append(getWord(subNum));

    }

    return returnValue.toString();
}

From source file:org.apache.pdfbox.encoding.Encoding.java

/**
 * This will get the character from the name.
 *
 * @param name The name of the character.
 *
 * @return The printable character for the code.
 */// w  ww. j  a va2  s . c om
public String getCharacter(String name) {
    String character = NAME_TO_CHARACTER.get(name);
    if (character == null) {
        // test if we have a suffix and if so remove it
        if (name.indexOf('.') > 0) {
            character = getCharacter(name.substring(0, name.indexOf('.')));
        }
        // test for Unicode name
        // (uniXXXX - XXXX must be a multiple of four;
        // each representing a hexadecimal Unicode code point)
        else if (name.startsWith("uni")) {
            int nameLength = name.length();
            StringBuilder uniStr = new StringBuilder();
            try {
                for (int chPos = 3; chPos + 4 <= nameLength; chPos += 4) {
                    int characterCode = Integer.parseInt(name.substring(chPos, chPos + 4), 16);

                    if (characterCode > 0xD7FF && characterCode < 0xE000) {
                        LOG.warn("Unicode character name with not allowed code area: " + name);
                    } else {
                        uniStr.append((char) characterCode);
                    }
                }
                character = uniStr.toString();
                NAME_TO_CHARACTER.put(name, character);
            } catch (NumberFormatException nfe) {
                LOG.warn("Not a number in Unicode character name: " + name);
                character = name;
            }
        }
        // test for an alternate Unicode name representation 
        else if (name.startsWith("u")) {
            try {
                int characterCode = Integer.parseInt(name.substring(1), 16);
                if (characterCode > 0xD7FF && characterCode < 0xE000) {
                    LOG.warn("Unicode character name with not allowed code area: " + name);
                } else {
                    character = String.valueOf((char) characterCode);
                    NAME_TO_CHARACTER.put(name, character);
                }
            } catch (NumberFormatException nfe) {
                LOG.warn("Not a number in Unicode character name: " + name);
                character = name;
            }
        } else if (nameToCode.containsKey(name)) {
            int code = nameToCode.get(name);
            character = Character.toString((char) code);
        } else {
            character = name;
        }
    }
    return character;
}

From source file:net.sf.jabref.gui.AutoCompleteListener.java

/**
 * Start a new completion attempt//from  ww  w  .j a  v  a  2  s .  c  o  m
 * (instead of treating a continuation of an existing word or an interrupt of the current word)
 */
private void startCompletion(StringBuffer currentword, KeyEvent e) {
    JTextComponent comp = (JTextComponent) e.getSource();

    String[] completed = findCompletions(currentword.toString(), comp);
    String prefix = completer.getPrefix();
    String cWord = (prefix != null) && (!prefix.isEmpty()) ? currentword.toString().substring(prefix.length())
            : currentword.toString();

    LOGGER.debug("StartCompletion currentword: >" + currentword + "'<' prefix: >" + prefix + "'<' cword: >"
            + cWord + '<');

    int no = 0; // We use the first word in the array of completions.
    if ((completed != null) && (completed.length > 0)) {
        lastShownCompletion = 0;
        lastCompletions = completed;
        String sno = completed[no];

        // these two lines obey the user's input
        //toSetIn = Character.toString(ch);
        //toSetIn = toSetIn.concat(sno.substring(cWord.length()));
        // BUT we obey the completion
        toSetIn = sno.substring(cWord.length() - 1);

        LOGGER.debug("toSetIn: >" + toSetIn + '<');

        StringBuilder alltext = new StringBuilder(comp.getText());
        int cp = comp.getCaretPosition();
        alltext.insert(cp, toSetIn);
        comp.setText(alltext.toString());
        comp.setCaretPosition(cp);
        comp.select(cp + 1, (cp + 1 + sno.length()) - cWord.length());
        e.consume();
        lastCaretPosition = comp.getCaretPosition();
        char ch = e.getKeyChar();

        LOGGER.debug("Appending >" + ch + '<');

        if (cWord.length() <= 1) {
            lastBeginning = Character.toString(ch);
        } else {
            lastBeginning = cWord.substring(0, cWord.length() - 1).concat(Character.toString(ch));
        }
    }

}

From source file:com.puppetlabs.geppetto.pp.dsl.contentassist.PPProposalsGenerator.java

private String toInitialUpperCase(String s) {
    if (s == null || s.length() < 1)
        return s;
    char c = s.charAt(0);
    if (Character.isUpperCase(c))
        return s;
    return Character.toString(c).toUpperCase() + s.substring(1);
}

From source file:com.livinglogic.ul4.FunctionFormat.java

private static String formatIntegerString(String string, boolean neg, IntegerFormat format) {
    if (format.align == '=') {
        int minimumwidth = format.minimumwidth;
        if (neg || format.sign != '-')
            --minimumwidth;/*  w  w  w .j  a  v a2  s .  co m*/
        if (format.alternate
                && (format.type == 'b' || format.type == 'o' || format.type == 'x' || format.type == 'X'))
            minimumwidth -= 2;

        if (string.length() < minimumwidth)
            string = StringUtils.repeat(Character.toString(format.fill), minimumwidth - string.length())
                    + string;

        if (format.alternate
                && (format.type == 'b' || format.type == 'o' || format.type == 'x' || format.type == 'X'))
            string = "0" + Character.toString(format.type) + string;

        if (neg)
            string = "-" + string;
        else {
            if (format.sign != '-')
                string = Character.toString(format.sign) + string;
        }
        return string;
    } else {
        if (format.alternate
                && (format.type == 'b' || format.type == 'o' || format.type == 'x' || format.type == 'X'))
            string = "0" + Character.toString(format.type) + string;
        if (neg)
            string = "-" + string;
        else {
            if (format.sign != '-')
                string = Character.toString(format.sign) + string;
        }
        if (string.length() < format.minimumwidth) {
            if (format.align == '<')
                string = string + StringUtils.repeat(Character.toString(format.fill),
                        format.minimumwidth - string.length());
            else if (format.align == '>')
                string = StringUtils.repeat(Character.toString(format.fill),
                        format.minimumwidth - string.length()) + string;
            else // if (format.align == '^')
            {
                int pad = format.minimumwidth - string.length();
                int padBefore = pad / 2;
                int padAfter = pad - padBefore;
                string = StringUtils.repeat(Character.toString(format.fill), padBefore) + string
                        + StringUtils.repeat(Character.toString(format.fill), padAfter);
            }
        }
        return string;
    }
}

From source file:br.com.diegosilva.jsfcomponents.util.Utils.java

public static String convertUnderscoreToCamelCase(String s) {
    StringBuilder sb = new StringBuilder();
    boolean uppercaseNextChar = false;
    for (char c : s.toCharArray()) {
        if (c == '_') {
            uppercaseNextChar = true;//  w w w  .j  av a2s .c  om
        } else {
            if (uppercaseNextChar) {
                sb.append(Character.toString(c).toUpperCase());
                uppercaseNextChar = false;
            } else {
                sb.append(c);
            }
        }
    }
    return sb.toString();
}

From source file:es.udl.asic.user.OpenLdapDirectoryProvider.java

/**
 * Borrowed from the jldap provider//from   w  w  w  . ja  v a2s. c o  m
 */
public String escapeSearchFilterTerm(String term) {
    if (term == null)
        return null;
    //From RFC 2254
    String escapedStr = new String(term);
    escapedStr = escapedStr.replaceAll("\\\\", "\\\\5c");
    escapedStr = escapedStr.replaceAll("\\*", "\\\\2a");
    escapedStr = escapedStr.replaceAll("\\(", "\\\\28");
    escapedStr = escapedStr.replaceAll("\\)", "\\\\29");
    escapedStr = escapedStr.replaceAll("\\" + Character.toString('\u0000'), "\\\\00");
    return escapedStr;
}

From source file:com.lgallardo.youtorrentcontroller.TorrentDetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Tell the host activity that your fragment has menu options that it
    // wants to add/replace/delete using the onCreateOptionsMenu method.
    setHasOptionsMenu(true);/* ww  w.j a  v  a  2 s  .co  m*/

    View rootView;

    rootView = inflater.inflate(R.layout.torrent_details, container, false);

    // Get Refresh Listener
    refreshListener = (RefreshListener) getActivity();
    mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.details_refresh_layout);

    if (mSwipeRefreshLayout != null) {
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                refreshListener.swipeRefresh();
            }
        });
    }

    // Hide herderInfo and title in phone's view
    if (getActivity().findViewById(R.id.one_frame) != null && MainActivity.headerInfo != null) {
        MainActivity.headerInfo.setVisibility(View.GONE);
        //            ((MainActivity) getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false);

        ((MainActivity) getActivity()).setTitle("");
    }

    savePath = "";
    creationDate = "";
    comment = "";
    uploadRateLimit = "";
    downloadRateLimit = "";
    totalWasted = "";
    totalUploaded = "";
    totalDownloaded = "";
    timeElapsed = "";
    nbConnections = "";
    shareRatio = "";

    try {

        if (savedInstanceState != null) {

            // Get saved values
            name = savedInstanceState.getString("torrentDetailName", "");
            size = savedInstanceState.getString("torrentDetailSize", "");
            hash = savedInstanceState.getString("torrentDetailHash", "");
            ratio = savedInstanceState.getString("torrentDetailRatio", "");
            state = savedInstanceState.getString("torrentDetailState", "");
            peersConnected = savedInstanceState.getInt("torrentDetailPeersConnected", 0);
            peersInSwarm = savedInstanceState.getInt("torrentDetailPeersInSwarm", 0);
            seedsConnected = savedInstanceState.getInt("torrentDetailSeedsConnected", 0);
            seedsInSwarm = savedInstanceState.getInt("torrentDetailSeedsInSwarm", 0);
            progress = savedInstanceState.getString("torrentDetailProgress", "");
            priority = savedInstanceState.getString("torrentDetailPriority", "");
            eta = savedInstanceState.getString("torrentDetailEta", "");
            uploadSpeed = savedInstanceState.getString("torrentDetailUploadSpeed", "");
            downloadSpeed = savedInstanceState.getString("torrentDetailDownloadSpeed", "");
            downloaded = savedInstanceState.getString("torrentDetailDownloaded", "");
            hashToUpdate = hash;

            // Only for Pro version
            if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) {
                int index = progress.indexOf(".");

                if (index == -1) {
                    index = progress.indexOf(",");

                    if (index == -1) {
                        index = progress.length();
                    }
                }

                percentage = progress.substring(0, index);
            }

        } else {

            // Get values from current activity
            name = this.torrent.getFile();
            size = this.torrent.getSize();
            hash = this.torrent.getHash();
            ratio = this.torrent.getRatio();
            state = this.torrent.getState();
            peersConnected = this.torrent.getPeersConnected();
            peersInSwarm = this.torrent.getPeersInSwarm();
            seedsConnected = this.torrent.getSeedsConnected();
            seedsInSwarm = this.torrent.getSeedInSwarm();
            progress = this.torrent.getProgress();
            priority = this.torrent.getPriority();
            eta = this.torrent.getEta();
            uploadSpeed = this.torrent.getUploadSpeed();
            downloadSpeed = this.torrent.getDownloadSpeed();
            hashToUpdate = hash;
            downloaded = this.torrent.getDownloaded();

            // Only for Pro version
            if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) {
                int index = this.torrent.getProgress().indexOf(".");

                if (index == -1) {
                    index = this.torrent.getProgress().indexOf(",");

                    if (index == -1) {
                        index = this.torrent.getProgress().length();
                    }
                }

                percentage = this.torrent.getProgress().substring(0, index);
            }
        }

        int donwloadSpeedWeigth = torrent.getDownloadSpeedWeight();
        int uploadSpeedWeigth = torrent.getUploadSpeedWeight();

        TextView nameTextView = (TextView) rootView.findViewById(R.id.torrentName);
        TextView sizeTextView = (TextView) rootView.findViewById(R.id.torrentSize);
        TextView ratioTextView = (TextView) rootView.findViewById(R.id.torrentRatio);
        TextView progressTextView = (TextView) rootView.findViewById(R.id.torrentProgress);
        TextView stateTextView = (TextView) rootView.findViewById(R.id.torrentState);
        TextView priorityTextView = (TextView) rootView.findViewById(R.id.torrentPriority);
        TextView leechsTextView = (TextView) rootView.findViewById(R.id.torrentLeechs);
        TextView seedsTextView = (TextView) rootView.findViewById(R.id.torrentSeeds);
        TextView hashTextView = (TextView) rootView.findViewById(R.id.torrentHash);
        TextView etaTextView = (TextView) rootView.findViewById(R.id.torrentEta);
        TextView uploadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentUploadSpeed);
        TextView downloadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentDownloadSpeed);

        CheckBox sequentialDownloadCheckBox;
        CheckBox firstLAstPiecePrioCheckBox;

        nameTextView.setText(name);
        ratioTextView.setText(ratio);
        stateTextView.setText(state);
        leechsTextView.setText("" + peersConnected + " (" + peersInSwarm + ")");
        seedsTextView.setText("" + seedsConnected + " (" + seedsInSwarm + ")");
        progressTextView.setText(progress);
        hashTextView.setText(hash);
        etaTextView.setText(eta);
        priorityTextView.setText(priority);

        // Set Downloaded vs Total size
        sizeTextView.setText(downloaded + " / " + size);

        // Only for Pro version
        if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontrollerpro")) {
            downloadSpeedTextView.setText(Character.toString('\u2193') + " " + downloadSpeed);
            uploadSpeedTextView.setText(Character.toString('\u2191') + " " + uploadSpeed);

            // Set progress bar
            ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1);
            TextView percentageTV = (TextView) rootView.findViewById(R.id.percentage);

            progressBar.setProgress(Integer.parseInt(percentage));
            percentageTV.setText(percentage + "%");
        } else {
            downloadSpeedTextView.setText(downloadSpeed);
            uploadSpeedTextView.setText(uploadSpeed);
        }

        nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.error, 0, 0, 0);

        //            Log.d("Debug", "TorrentDetailsFragment - state: " + state);

        if ("paused".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.paused, 0, 0, 0);
        }

        if ("downloading".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalleddl, 0, 0, 0);

            if (donwloadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) {
                nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.downloading, 0, 0, 0);
            }
        }

        if ("seeding".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalledup, 0, 0, 0);

            if (uploadSpeedWeigth > 0 || seedsConnected > 0 || peersConnected > 0) {
                nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.uploading, 0, 0, 0);
            }
        }

        if ("queued".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.queued, 0, 0, 0);
        }

        if ("checking".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0);
        }

        if ("stopped".equals(state)) {
            nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_stopped, 0, 0, 0);
        }

        //            // Get Content files in background
        //            qBittorrentContentFile qcf = new qBittorrentContentFile();
        //            qcf.execute(new View[]{rootView});
        //
        //            // Get trackers in background
        //            qBittorrentTrackers qt = new qBittorrentTrackers();
        //            qt.execute(new View[]{rootView});
        //
        //            // Get general info in background
        //            qBittorrentGeneralInfoTask qgit = new qBittorrentGeneralInfoTask();
        //            qgit.execute(new View[]{rootView});

    } catch (Exception e) {
        Log.e("Debug", "TorrentDetailsFragment - onCreateView: " + e.toString());
    }

    if (MainActivity.packageName.equals("com.lgallardo.youtorrentcontroller")) {
        // Load banner
        loadBanner();
    }

    return rootView;
}

From source file:net.sf.jabref.gui.autocompleter.AutoCompleteListener.java

/**
 * Start a new completion attempt (instead of treating a continuation of an existing word or an interrupt of the
 * current word)/*from w ww  .j  a  v  a2s.c o m*/
 */
private void startCompletion(StringBuffer currentword, KeyEvent e) {
    JTextComponent comp = (JTextComponent) e.getSource();

    List<String> completed = findCompletions(currentword.toString());
    String prefix = completer.getPrefix();
    String cWord = (prefix != null) && (!prefix.isEmpty()) ? currentword.toString().substring(prefix.length())
            : currentword.toString();

    LOGGER.debug("StartCompletion currentword: >" + currentword + "'<' prefix: >" + prefix + "'<' cword: >"
            + cWord + '<');

    int no = 0; // We use the first word in the array of completions.
    if ((completed != null) && (!completed.isEmpty())) {
        lastShownCompletion = 0;
        lastCompletions = completed;
        String sno = completed.get(no);

        // these two lines obey the user's input
        //toSetIn = Character.toString(ch);
        //toSetIn = toSetIn.concat(sno.substring(cWord.length()));
        // BUT we obey the completion
        toSetIn = sno.substring(cWord.length() - 1);

        LOGGER.debug("toSetIn: >" + toSetIn + '<');

        StringBuilder alltext = new StringBuilder(comp.getText());
        int cp = comp.getCaretPosition();
        alltext.insert(cp, toSetIn);
        comp.setText(alltext.toString());
        comp.setCaretPosition(cp);
        comp.select(cp + 1, (cp + 1 + sno.length()) - cWord.length());
        e.consume();
        lastCaretPosition = comp.getCaretPosition();
        char ch = e.getKeyChar();

        LOGGER.debug("Appending >" + ch + '<');

        if (cWord.length() <= 1) {
            lastBeginning = Character.toString(ch);
        } else {
            lastBeginning = cWord.substring(0, cWord.length() - 1).concat(Character.toString(ch));
        }
    }

}