Example usage for java.lang CharSequence toString

List of usage examples for java.lang CharSequence toString

Introduction

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

Prototype

public String toString();

Source Link

Document

Returns a string containing the characters in this sequence in the same order as this sequence.

Usage

From source file:de.fmaul.android.cmis.utils.FeedUtils.java

public static String getSearchQueryFeed(String urlTemplate, String query) {
    final CharSequence feedUrl = TextUtils.replace(urlTemplate,
            new String[] { "{q}", "{searchAllVersions}", "{maxItems}", "{skipCount}",
                    "{includeAllowableActions}", "{includeRelationships}" },
            new String[] { query, "false", "50", "0", "false", "false" });

    return feedUrl.toString();
}

From source file:org.ttrssreader.utils.Utils.java

public static String getTextFromClipboard(Context context) {
    // New Clipboard API
    ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
    if (clipboard.hasPrimaryClip()) {

        if (!clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN))
            return null;

        ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
        CharSequence chars = item.getText();
        if (chars != null && chars.length() > 0) {
            return chars.toString();
        } else {//  w ww.j  a v  a 2 s.com
            Uri pasteUri = item.getUri();
            if (pasteUri != null) {
                return pasteUri.toString();
            }
        }
    }
    return null;
}

From source file:de.fmaul.android.cmis.utils.FeedUtils.java

public static String getSearchQueryFeedCmisQuery(String urlTemplate, String cmisQuery) {
    String encodedCmisQuery = "";
    try {//w w w. j a  v a  2s . c o m
        encodedCmisQuery = URLEncoder.encode(cmisQuery, "iso-8859-1");
    } catch (UnsupportedEncodingException e) {
        encodedCmisQuery = URLEncoder.encode(cmisQuery);
    }

    final CharSequence feedUrl = TextUtils.replace(urlTemplate,
            new String[] { "{q}", "{searchAllVersions}", "{maxItems}", "{skipCount}",
                    "{includeAllowableActions}", "{includeRelationships}" },
            new String[] { encodedCmisQuery, "false", "50", "0", "false", "false" });

    return feedUrl.toString();
}

From source file:org.cleverbus.common.Strings.java

@Nullable
public static String toString(@Nullable CharSequence c) {
    return c == null ? null : c.toString();
}

From source file:com.simiacryptus.mindseye.applications.ArtistryUtil.java

/**
 * Gets local files./*from w  w w  .  j  a v a 2  s. co m*/
 *
 * @param file the file
 * @return the local files
 */
public static List<CharSequence> getLocalFiles(CharSequence file) {
    File[] array = new File(file.toString()).listFiles();
    if (null == array)
        throw new IllegalArgumentException("Not Found: " + file);
    return Arrays.stream(array).map(File::getAbsolutePath).sorted(Comparator.naturalOrder())
            .collect(Collectors.toList());
}

From source file:mp.paschalis.App.java

/**
 * @param pTimestamp//from w ww  .j av  a 2 s. c  om
 * @return
 */
public static String makeTimeStampHumanReadble(Context context, String pTimestamp) {

    try {

        SimpleDateFormat datetimeFormatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        java.util.Date lFromDate1 = datetimeFormatter1.parse(pTimestamp);

        CharSequence humansTime = DateUtils.getRelativeTimeSpanString(context, lFromDate1.getTime());

        return humansTime.toString();
    } catch (Exception e) {
        return pTimestamp;
    }

}

From source file:jp.co.ctc_g.jse.core.validation.util.Validators.java

private static String replaceDecimalValue(CharSequence suspect) {
    String source = suspect.toString();
    source = source.replace("?", "-");
    source = source.replace("", "");
    source = source.replace(",", "");
    source = source.replace("", ".");
    return source;
}

From source file:jp.co.ctc_g.jse.core.validation.util.Validators.java

/**
 * ????????????/*from   w  w w  .  ja va 2s  . com*/
 * ??{@link GenericValidator#isEmail(String)}?????
 * @param suspect 
 * @return GenericValidator#isEmail(String)??
 */
public static boolean isEmail(CharSequence suspect) {
    return GenericValidator.isEmail(suspect.toString());
}

From source file:jp.co.ctc_g.jse.core.validation.util.Validators.java

/**
 * ?"Windows-31J"???????????????2??????????
 * @param suspect /*from  ww w .  j  av  a 2 s.  co m*/
 * @return ???true
 */
public static boolean isZenkaku(CharSequence suspect) {
    try {
        byte[] sjis = suspect.toString().getBytes(WINDOWS31_J);
        return sjis.length == (suspect.length() * 2);
    } catch (UnsupportedEncodingException e) {
        return false;
    }
}

From source file:jp.co.ctc_g.jse.core.validation.util.Validators.java

/**
 * ?????????????????????// w  w  w  .  j  a v  a2 s  .  c o  m
 * ??{@link GenericValidator#minLength(String, int)}?????
 * @param suspect 
 * @param size 
 * @return GenericValidator#minLength(String, int)??
 */
public static boolean minLength(CharSequence suspect, int size) {
    return GenericValidator.minLength(suspect.toString(), size);
}