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). 输入格式: 共两行,每一行为一个字符串 ...
随机推荐
- 使用bbed改动数据
bbed是一个强大的工具,同意我们绕过oracle直接从数据文件里改动相应的内容 ZBDBA@orcl11g>select * from emp; EMPNO ENAME JOB MGR HIR ...
- Linux 内核开发 - 内存管理
1.1什么是内存管理 内存管理是对计算机内存进行分配和使用的技术.内存管理主要存在于多任务的操作系统中,因为内存资源极其有限.须要在不同的任务之间共享内存,内存管理的存在就是要高效.高速的非配内存,并 ...
- 关于微软网站维护培训时遇到的issues:What is WEDCS?
WEDCS (pronounced “wed-ex”), the Web Events Data Collection Service, is a system for collecting, com ...
- web 开发之js---js获取select标签选中的值
var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // 选中索引 va ...
- bzoj4974: [Lydsy1708月赛]字符串大师
脑洞题...玄学 假如是a[i]!=i,说明构成了循环节长为a[i]的循环,那就去%一下(别想多)看一下是循环节中的第几个咯. 否则新填的这个不能和前面构成任何循环,那就不停往前跳去把不能填的标记一下 ...
- 2-5 原生小程序 - 语法缺点.mp4
- codeforces 402E - Strictly Positive Matrix【tarjan】
首先认识一下01邻接矩阵k次幂的意义:经过k条边(x,y)之间的路径条数 所以可以把矩阵当成邻接矩阵,全是>0的话意味着两两之间都能相连,也就是整个都要在一个强连通分量里,所以直接tarjan染 ...
- P1266 速度限制(分层图spfa)
P1266 速度限制 题目描述 在这个繁忙的社会中,我们往往不再去选择最短的道路,而是选择最快的路线.开车时每条道路的限速成为最关键的问题.不幸的是,有一些限速的标志丢失了,因此你无法得知应该开多快. ...
- 【转】@Controller和@RestController的区别
知识点:@RestController注解相当于@ResponseBody + @Controller合在一起的作用. 1) 如果只是使用@RestController注解Controller,则Co ...
- loadrunner乱码解决
对于Virtual User Generator,本机编码方式为GB2312,GBK,GB18030,因此要修改为utf-8 1.录制过程产生的乱码解决方法: 在tool→recording opti ...