当前位置: 首页>>代码示例>>Java>>正文


Java Spanned.charAt方法代码示例

本文整理汇总了Java中android.text.Spanned.charAt方法的典型用法代码示例。如果您正苦于以下问题:Java Spanned.charAt方法的具体用法?Java Spanned.charAt怎么用?Java Spanned.charAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.Spanned的用法示例。


在下文中一共展示了Spanned.charAt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNumbers

import android.text.Spanned; //导入方法依赖的package包/类
public List<String> getNumbers() {
    Spanned sp = mList.getText();
    int len = sp.length();
    List<String> list = new ArrayList<String>();

    int start = 0;
    int i = 0;
    while (i < len + 1) {
        char c;
        if ((i == len) || ((c = sp.charAt(i)) == ',') || (c == ';')) {
            if (i > start) {
                list.add(getNumberAt(sp, start, i, mContext));

                // calculate the recipients total length. This is so if the name contains
                // commas or semis, we'll skip over the whole name to the next
                // recipient, rather than parsing this single name into multiple
                // recipients.
                int spanLen = getSpanLength(sp, start, i, mContext);
                if (spanLen > i) {
                    i = spanLen;
                }
            }

            i++;

            while ((i < len) && (sp.charAt(i) == ' ')) {
                i++;
            }

            start = i;
        } else {
            i++;
        }
    }

    return list;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:38,代码来源:RecipientsEditor.java

示例2: findLineBreakPosition

import android.text.Spanned; //导入方法依赖的package包/类
private int findLineBreakPosition(Spanned dest, int dstart) {
    int istart = dstart - 1;

    for (; istart > -1; --istart) {
        char c = dest.charAt(istart);
        if (c == '\n') {
            break;
        }
    }
    return istart;
}
 
开发者ID:gsantner,项目名称:markor,代码行数:12,代码来源:MarkdownAutoFormat.java

示例3: findLineBreakPosition

import android.text.Spanned; //导入方法依赖的package包/类
private int findLineBreakPosition(Spanned dest, int dstart) {
    int istart = dstart - 1;

    for (; istart > -1; --istart) {
        char c = dest.charAt(istart);

        if (c == '\n')
            break;
    }
    return istart;
}
 
开发者ID:gsantner,项目名称:markor,代码行数:12,代码来源:TodoTxtAutoFormat.java

示例4: createIndentForNextLine

import android.text.Spanned; //导入方法依赖的package包/类
private String createIndentForNextLine(Spanned dest, int dend, int istart) {
    if (AppSettings.get().isTodoStartTasksWithTodaysDateEnabled()) {
        if (dend == 0 || (dend == dest.length() || dend == dest.length() - 1)
                || (dest.charAt(dend) == '\n')) {
            return SttCommander.DATEF_YYYY_MM_DD.format(new Date()) + " ";
        }
    }
    return "";
}
 
开发者ID:gsantner,项目名称:markor,代码行数:10,代码来源:TodoTxtAutoFormat.java

示例5: getRecipientList

import android.text.Spanned; //导入方法依赖的package包/类
public RecipientList getRecipientList() {
    Spanned sp = mList.getText();
    int len = sp.length();
    RecipientList rl = new RecipientList();
    
    int start = 0;
    int i = 0;
    while (i < len + 1) {
        if ((i == len) || (sp.charAt(i) == ',')) {
            if (i > start) {
                Recipient r = getRecipientAt(sp, start, i);

                rl.add(r);
            }

            i++;

            while ((i < len) && (sp.charAt(i) == ' ')) {
                i++;
            }

            start = i;
        } else {
            i++;
        }
    }

    return rl;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:30,代码来源:RecipientsEditor.java

示例6: withinBlockquoteConsecutive

import android.text.Spanned; //导入方法依赖的package包/类
private static void withinBlockquoteConsecutive(Context context, StringBuilder out, Spanned text,
                                                int start, int end) {
    out.append("<p").append(getTextDirection(text, start, end)).append(">");
    int next;
    for (int i = start; i < end; i = next) {
        next = TextUtils.indexOf(text, '\n', i, end);
        if (next < 0) {
            next = end;
        }
        int nl = 0;
        while (next < end && text.charAt(next) == '\n') {
            nl++;
            next++;
        }
        withinParagraph(context, out, text, i, next - nl);
        if (nl == 1) {
            out.append("<br>\n");
        } else {
            for (int j = 2; j < nl; j++) {
                out.append("<br>");
            }
            if (next != end) {
                /* Paragraph should be closed and reopened */
                out.append("</p>\n");
                out.append("<p").append(getTextDirection(text, start, end)).append(">");
            }
        }
    }
    out.append("</p>\n");
}
 
开发者ID:Pixplicity,项目名称:HtmlCompat,代码行数:31,代码来源:HtmlCompat.java


注:本文中的android.text.Spanned.charAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。