惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
MongoDB | Blog
MongoDB | Blog
D
Docker
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
U
Unit 42

博客园 - 泡泡

设置文件属性 VC - 泡泡 - 博客园 程序小注意 - 泡泡 - 博客园 有关进程创建,与子进程的路径指定 dll 有关CComboBox - 泡泡 - 博客园 有关线程 ADO 存储过程 - 泡泡 - 博客园 VC执行存储过程 - 泡泡 - 博客园 读写文件操作 - 泡泡 - 博客园 Access数据库SQL操作 ComboBox控件-转 CTime 常用字符转换 音频 Inno SetUp 控件LIST 有关音频编码 窗口透明、半透明 Windows Media
字符串分解
泡泡 · 2006-06-20 · via 博客园 - 泡泡

一、以空格为判断
注:0x00  ==0x00是不可见字符-,所以不能用广西方式 定稿。必须用二进制方式 打开文件后才能写入。否则,0x00被认为是字符串结束标志。

调用 :
   CStringArray arr;
 GetCmdLinePara(arr);
值获取:arr.GetAt(0);……
void CUpdateInstall::GetCmdLinePara(CStringArray &paraArr)
{
 paraArr.RemoveAll();
//CString strLine=::AfxGetApp()->m_lpCmdLine;
CString strLine;
 strLine = "updateLobby 大厅安装程序4.0 http://192.168.0.2/update/updateLobby.ini";
 if(strLine.IsEmpty())
  return;

 strLine.TrimLeft();
 strLine.TrimRight();
 int nLength=strLine.GetLength();
 char *buf=new char[nLength+1];
 strcpy(buf,strLine);
 char *p=buf;
 for(int i=0;i<128;i++)
 {
  if(buf[i]==0x20)//空格
  {
   buf[i]=0x00;
   paraArr.Add(p);
   i++;
   p=buf+i;
  }
  if(buf[i]==0x00)//十进制的0
  {
   paraArr.Add(p);
   break;
  }
 }
 delete buf;
}

二。字符串分解
注:分解后,得到strSection = updateLobby
 说明:m_strIniName.Find(m_strIniPath.GetAt(p))  找到这个字符如('/')在字符串中的 第几个(如0 1 2 …
          
 int p;
CString m_strIniPath = "./temp/updateLobby.ini"
 CString m_strIniName = m_strIniPath;
 for(int i=0;i<m_strIniPath.GetLength();i++)
 {
  if(m_strIniPath.GetAt(i)=='/')
  {
   p=i;
   m_strIniName = m_strIniName.Right(m_strIniName.GetLength() - m_strIniName.Find(m_strIniPath.GetAt(p))-1);//取得它右边的字符串如得:updateLobby.ini
  }
  m_strSection =m_strIniName.Left(m_strIniName.Find("."));
 }
三。
如 /temp/load/a.ini   分解得到a.ini
int n=strFile.ReverseFind('/');
str2 = strFile.Right(strFile.GetLength()-n-1);