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). 输入格式: 共两行,每一行为一个字符串 ...
随机推荐
- 前端开发本地环境配置(Apache+Dreamweaver)
一.安装apache服务器 1.下载apache软件: 2.安装,直接下一步就好: 3.安装好后找到安装文件夹下的conf文件中的httpd.conf: 4.打开httpd.conf文件,做以下修改: ...
- make常见报错原因分析
1 No rule to make target ‘xxx’ 原因一般是'xxx'文件不存在,首先应该去相应的目录检查文件是否存在.
- location.replace
[root@bigdata-server-01 ~]# curl www.baidu.com<!DOCTYPE html><!--STATUS OK--><html> ...
- HQL 查询数据 (获取页面输入的查询条件字段)
/* * 查询提取位置表所有数据 * */ public String ListEtlExtractPositionOfAll(){ // 接受数据库中传送的code int code = Integ ...
- bzoj1875 [SDOI2009]HH去散步——矩阵快速幂
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1875 有个限制是不能走回头路,比较麻烦: 所以把矩阵中的元素设成边的经过次数,单向边之间就好 ...
- IOS程序运行过程
IOS程序是从main开始运行的,main.m文件内容如下: #import <UIKit/UIKit.h> #import "AppDelegate.h" int m ...
- 谷歌浏览器(Chrome)查看http报文headers信息
转自:https://blog.csdn.net/floatdreamed/article/details/79208719 ①打开谷歌浏览器,随意输入要搜索的内容 ②按下F12键,此时会弹出浏览器的 ...
- svchost.exe 占用内存过多
http://www.tomshardware.com/forum/20583-63-svchost-netsvcs-speed By Lokesh Chandra: Just Go to Contr ...
- 8 种提升ASP.NET Web API性能的方法
ASP.NET Web API 是非常棒的技术.编写 Web API 十分容易,以致于很多开发者没有在应用程序结构设计上花时间来获得很好的执行性能. 在本文中,我将介绍8项提高 ASP.NET Web ...
- Spring通过注解注入有参
1.通过注解方式注入有参的构造函数 把@Autowired注解放在构造函数上方,在构造函数里写上需要注入的形参即可 2.通过XML配置文件方式定义有参构造函数