本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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 "";
}
示例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;
}
示例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");
}