字符串截取问题 高手进

[复制链接]
查看11 | 回复3 | 2011-7-14 14:36:49 | 显示全部楼层 |阅读模式
用到HTML模板标签
要截取显示内容长度
这个截取过程怎么写
{$3,30$}
例如这样一个标签第二个数据30 用来控制输出字符串长度
这个过程怎么实现

回复

使用道具 举报

千问 | 2011-7-14 14:36:49 | 显示全部楼层
class Program
{
static void Main(string[] args)
{
string content = "{$3,30$}";
//获得定义的标签设置
string[] items = content.Split(new string[] { "{$", "$}" }, StringSplitOptions.RemoveEmptyEntries);
//分解标签,获得具体设置
foreach (string item in items) ...
回复

使用道具 举报

千问 | 2011-7-14 14:36:49 | 显示全部楼层
class TestSplit { public String getsplit(String temp){ int i = temp.indexOf(","); int j = temp.lastIndexOf("$"); String str1 = temp.substring(i+1,j);ret...
回复

使用道具 举报

千问 | 2011-7-14 14:36:49 | 显示全部楼层
string str=content;//你的文章内容。int start=0;//开始截取的位置int lengh=30;//截取长度 string result=str.substring(start,length);//利用substring函数进行截取。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行