C# 字符串每隔两个 提取
private void button3_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
string str = "686B666B686B666B706B5D9BACAFA0AC5D683532303833393737";
for ( int i = ; i < str.Length; i++)
{
if (i % == ) //奇数 ...1
{
sb.Append(str[i]);
sb.Append(" ");
continue;
}
sb.Append(str[i]);
}
var result = sb.ToString();
}
//指定数据前移
strlist = new string[] { "","A","", "B" };
for (int i = ; i < strlist.Length; i++)
{
//空数据 前移
if (strlist[i] == "")
{
test(strlist, i);
}
}
public void test(string[] strlist, int index)
{
for (int i = index; i < strlist.Length; i++)
{
if (i + >= strlist.Length)
{
strlist[i] = ""; //要替换的值
continue;
}
strlist[i] = strlist[i + ];
}
}
ssid
private void button3_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
string str = "686B666B686B666B706B5D9BACAFA0AC5D683532303833393737";
for (int i = ; i < str.Length; i++)
{
if (i % == ) //奇数 ...1
{
sb.Append(str[i]);
sb.Append("\r\n");
continue;
}
sb.Append(str[i]);
}
string result = sb.ToString();
string[] strlist = result.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);//返回值不包含空字符串元素, //去掉第三个和第7个 3=(i+1) i=2 第三个是2; 第七个是6; 取前8个字节
strlist[] = ""; strlist[] = ""; for (int i = ; i < strlist.Length; i++)
{
//空数据 前移
if (strlist[i] == "")
{
test(strlist, i);
}
} List<string> list = new List<string>();
for (int i = ; i < strlist.Length; i++)
{
list.Add(strlist[i]);
if (i == ( - ))
{
break;
}
}
//--减去37+30 = 67;
sb.Length = ;
for (int i = ;i<list.Count;i++)
{ var t = Convert.ToInt32(list[i]) - ; sb.Append(t); } } public void test(string[] strlist, int index)
{
for (int i = index; i < strlist.Length; i++)
{
if (i + >= strlist.Length)
{
strlist[i] = ""; //要替换的值
continue;
}
strlist[i] = strlist[i + ];
}
}
private void button3_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); string str = "686B666B686B666B706B5D9BACAFA0AC5D683532303833393737"; for (int i = 0; i < str.Length; i++) { if (i % 2 == 1) //奇数 ...1 { sb.Append(str[i]); sb.Append("\r\n"); continue; } sb.Append(str[i]); } string result = sb.ToString(); string[] strlist = result.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);//返回值不包含空字符串元素,
//去掉第三个和第7个 3=(i+1) i=2 第三个是2; 第七个是6; 取前8个字节 strlist[2] = ""; strlist[6] = "";
for (int i = 0; i < strlist.Length; i++) { //空数据 前移 if (strlist[i] == "") { test(strlist, i); } }
List<string> list = new List<string>(); for (int i = 0; i < strlist.Length; i++) { list.Add(strlist[i]); if (i == (8 - 1)) { break; } } //--减去37+30 = 67; sb.Length = 0; for (int i = 0;i<list.Count;i++) {
var t = Convert.ToInt32(list[i]) - 67;
sb.Append(t);
}
}
public void test(string[] strlist, int index) { for (int i = index; i < strlist.Length; i++) { if (i + 1 >= strlist.Length) { strlist[i] = ""; //要替换的值 continue; } strlist[i] = strlist[i + 1]; } }
C# 字符串每隔两个 提取的更多相关文章
- JS中substring()方法(用于提取字符串中介于两个指定下标之间的字符)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- JS对象 substring() 方法用于提取字符串中介于两个指定下标之间的字符。
提取字符串substring() substring() 方法用于提取字符串中介于两个指定下标之间的字符. 语法: stringObject.substring(starPos,stopPos) 参 ...
- substring() 方法用于提取字符串中介于两个指定下标之间的字符。
substring() 方法用于提取字符串中介于两个指定下标之间的字符. 语法 stringObject.substring(start,stop) 参数 描述 start 必需.一个非负的整数,规定 ...
- JS 从一个字符串中截取两个字符串之间的字符串
/************************************************* 函数说明:从一个字符串中截取 两个字符串之间的字符串 参数说明:src_str 原串, start ...
- SPOJ PHRASES 每个字符串至少出现两次且不重叠的最长子串
Description You are the King of Byteland. Your agents have just intercepted a batch of encrypted ene ...
- Js 字符串拼接的两种方法
字符串拼接的两种方法 用数组的方法的好处是:避免变量重新定义.赋值 <!DOCTYPE html> <html lang="en"> <head> ...
- 简单实现textview文本每隔两秒就改变一次
//这个方法可以实现文本每隔两秒就改变一次, public void textTask(){ final android.os.Handler handler=new android.os.Handl ...
- C++读取字符串数据的两种方式
C++读取字符串数据的两种方式 对于同样的样例输入: ladder came tape soon leader acme RIDE lone Dreis peat ScAlE orb eye Ride ...
- python3 练习题100例 (二十二)输入两个字符串,输出两个字符串集合的并集
题目内容: 输入两个字符串,输出两个字符串集合的并集. 为保证输出结果一致,请将集合内元素排序之后再输出, 如对于集合aset,可输出sorted(aset). 输入格式: 共两行,每一行为一个字符串 ...
随机推荐
- oracle事务处理及实例演示jdbc操作批量删除
事务 作为逻辑处理的基本单位,对于数据库操作来说由一条或者多条sql语句来构成.当然还有针对非数据库操作的,如在计算机中设置的还原点即是一个非常好的应用. 对于事务的基本性质在还有一篇中有所叙述:SQ ...
- Centos7 防火墙firewalld配置
开启80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent 出现success表明添加成功 移除某个端口 firewall-cmd ...
- Ubuntu新版中javascript-common.conf害死人啊
自动把javascript目录映射到系统的/usr/share 下面了,删掉对应的软链接再重启就好了
- 用js获取access_token
尝试用js获取access_token 最终失败告终,哈哈 1需要 appId和AppSecret 这两个参数是要保密的,建议不要暴露在外面,以防被别有用心的人利用. $.ajax({ url:'ht ...
- wrap(),wrapAll(),wrapInner()的区别
wrap从字面上理解就是包裹的意思,这三个函数也都是起到将内部节点进行包裹的作用,但是他们的各自的功能有又大不相同. 1. a.wrap(b) 这个函数的作用是用b将a进行包裹,其中a所选中的可以为 ...
- 0621补-MVC的基础整理
包括:Model-模型.view-视图.Controller-控制器. 特点: 将功能强制分成两个部分,显示html文件,和逻辑PHP文件: 要求浏览器请求负责功能的PHP逻辑文件,该PHP逻辑文件, ...
- 疫情控制 2012年NOIP全国联赛提高组(二分答案+贪心)
P1084 疫情控制 题目描述 H 国有 n 个城市,这 n 个城市用 n-1 条双向道路相互连通构成一棵树,1 号城市是首都,也是树中的根节点. H 国的首都爆发了一种危害性极高的传染病.当局为了控 ...
- Selct 大全
添加option $("#ID option").each(function(){ if($(this).val()==111){ $(this).remove(); } }); ...
- 关于ListView的注意点
解决ListView的一些常见问题: 1.listview在拖动的时候背景图片消失变成黑色背景,等到拖动完毕我们自己的背景图片才显示出来 解决:在XML中加入 android:scrollingCac ...
- [Code+#1]大吉大利,晚上吃鸡!
输入输出样例 输入样例#1: 7 7 1 7 1 2 2 2 4 2 4 6 2 6 7 2 1 3 2 3 5 4 5 7 2 输出样例#1: 6 输入样例#2: 5 5 1 4 1 2 1 1 3 ...