| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 681 人关注过本帖
标题:字符串中如何获取指定位置的字符
取消只看楼主 加入收藏
hmljg06
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-6-11
收藏
 问题点数:0 回复次数:2 
字符串中如何获取指定位置的字符
如题,如何分别获取
string str=
"IO1=001
 IO2=运行
 IO3=停止
 IO4=X10"
中=后的字符,即001,运行,停止以及X10
备注:=后的字符串是可变的
谢谢!
搜索更多相关主题的帖子: 如何 字符串 
2011-08-25 18:34
hmljg06
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-6-11
收藏
得分:0 
没有人吗
2011-08-25 18:49
hmljg06
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-6-11
收藏
得分:0 
已解决 3楼5楼没有理解我得意思 不过还是感谢
我说的是从一个文档里面读取数据 =后的字符没有规律
        static Label[] InputLable=new Label[16];
        static string[] StrSub=new string[34];
        static string[] StrLable = new string[32];

           InputLable[0] = label0; InputLable[1] = label1; InputLable[2] = label2; InputLable[3] = label3;
            InputLable[4] = label4; InputLable[5] = label5; InputLable[6] = label6; InputLable[7] = label7;
            InputLable[8] = label8; InputLable[9] = label9; InputLable[10] = label10; InputLable[11] = label11;
            InputLable[12] = label12; InputLable[13] = label13; InputLable[14] = label14; InputLable[15] = label15;


                StreamReader InputParaReader;
                InputParaReader = new StreamReader(@"C:\IOName.ini",Encoding.GetEncoding(936));
                StrSub[0] = InputParaReader.ReadToEnd();
                for (int i = 1; i < 34; i++)
                {
                    StrSub[i] = StrSub[i - 1].Substring(StrSub[i - 1].IndexOf("\n") + 1, StrSub[i - 1].Length - StrSub[i - 1].IndexOf("\n") - 1);
                }
                for (int a = 1; a < 17; a++)
                {
                    StrLable[a - 1] = StrSub[a].Substring(StrSub[a].IndexOf("=") + 1, StrSub[a].Length - StrSub[a + 1].Length - StrSub[a].IndexOf("=") - 1);

                }
                for (int i = 0; i < 16; i++)
                {
                    InputLable[i].Text = StrLable[i].ToString();
                }
2011-08-26 14:00
快速回复:字符串中如何获取指定位置的字符
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023546 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved