如何设置粗体字之前与QUOT; | " [英] how to set text in Bold Before " | "

查看:148
本文介绍了如何设置粗体字之前与QUOT; | "的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的code:

 的for(int i = indexRowStart; I< indexRowEnd;我++){
    元素e =(元)nl.item(I)
    //将每个子节点的HashMap键=>值
    地图=新的HashMap<字符串,字符串>();
    map.put(的RowID,将String.valueOf(的RowID));
    字符串标题= parser.getValue(即KEY_NAME).replace(|,| \\ n)替换(|,)。
    map.put(KEY_NAME,标题);
}

输出:


  

30 |在所得税法,1961年第120条 - 管辖权


解析我得到这个数据后,我想打印字符串之前 | 在BOLD信,在这种情况下,我想打印 30 的BOLD信。

任何帮助将AP preciated。


解决方案

 字符串标题= parser.getValue(即KEY_NAME);
INT A = Heading.indexOf(|);
串beforeSubString = Heading.substring(0,a)的
串afterSubString = Heading.substring(一,Heading.length() - 1);
字符串最后=< B>中+ beforeSubString +< B>+|+ afterSubString;
title.setText(Html.fromHtml(最终));

This is my code :

for (int i = indexRowStart; i < indexRowEnd; i++) {
    Element e = (Element) nl.item(i);
    // adding each child node to HashMap key => value
    map = new HashMap<String, String>();
    map.put("RowID", String.valueOf(RowID)); 
    String Heading = parser.getValue(e, KEY_NAME).replace("|","|\n").replace("|","");
    map.put(KEY_NAME, Heading);
}

Output:

30 | Section 120 of the Income-tax Act, 1961 – Jurisdiction of

After Parsing I am getting this data, I want to print the string Before | in BOLD letter, in this case I want to print 30 in BOLD letter.

Any help will be appreciated.

解决方案

String Heading = parser.getValue(e, KEY_NAME);
int a=Heading.indexOf("|");
String beforeSubString=Heading.substring(0, a);
String afterSubString=Heading.substring(a, Heading.length()-1);
String final="<b>"+beforeSubString+"<b>"+"|"+afterSubString;
title.setText(Html.fromHtml(final));

这篇关于如何设置粗体字之前与QUOT; | &QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆