第一种方式
#include "stdafx.h"
#include <string.h>
#include <stdio.h>
#include <Windows.h>
#include <atlbase.h>
#include <atlfile.h> int main(int argc,char** argv)
{
wchar_t temp[MAX_PATH] = L"Hello:words,what is your name?";
wchar_t* result = NULL;
wchar_t szname[MAX_PATH] = {0};
result = StrRStrIW(temp,NULL,L":");
printf("result = %S\r\n",result);
lstrcpy(szname,++result);
printf("Szname = %S\r\n",szname);
return 0;
} 输出: result = :words,what is your name?
Szname = words,what is your name?
第二种方式:

int main(int argc,char** argv)
{
char* name = "Hello word:your is what name?";
char* cres = NULL;
cres = strstr(name,":");
printf("Cres = %s\r\n",++cres);
return ;
} 输出: Cres = your is what name? char Szcmd[50] = "net+user+admin+admin/add"; 替换字符串: for(int i=0;i<=strlen(Szcmd);i++ )
        {
                if(Szcmd=='+')
                {
                        Szcmd=' ';
                }
        }
print "net user admin admin /add"
int main(int argc, char* argv[])
{
char String[1024] = "Hello word,thi sis a testing <a>Herf,this is xa </a> Balalaldsgvdfbdfbdf";
char* Findstr = nullptr;
char* FindEnd = nullptr;
Findstr = strstr(String,"<a>");
if (Findstr != NULL)
{
//printf("String = %s.\r\n",Findstr);
FindEnd = strstr(String,"</a>");
if (FindEnd != NULL)
{
printf("%.*s.\r\n",FindEnd - Findstr-3,Findstr+3);
}
}else
{
printf("String = nulls");
}
return 0;
}

output:Herf,this is xa .

VC查找字符串的更多相关文章

  1. 在文件夹中 的指定类型文件中 查找字符串(CodeBlocks+GCC编译,控制台程序,仅能在Windows上运行)

    说明: 程序使用 io.h 中的 _findfirst 和 _findnext 函数遍历文件夹,故而程序只能在 Windows 下使用. 程序遍历当前文件夹,对其中的文件夹执行递归遍历.同时检查遍历到 ...

  2. php查找字符串首次出现的位置 判断字符串是否在另一个字符串中

    strpos - 查找字符串首次出现的位置 说明 int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) 返回 nee ...

  3. 查找字符串的 KMP 算法

    查找字符串是我们平常编程过程中经常遇到的,现在介绍一种查找字符串算法,增加程序的执行速度. 通常我们是这么写的: /* content: search a string in a othor stri ...

  4. 回朔法/KMP算法-查找字符串

    回朔法:在字符串查找的时候最容易想到的是暴力查找,也就是回朔法.其思路是将要寻找的串的每个字符取出,然后按顺序在源串中查找,如果找到则返回true,否则源串索引向后移动一位,再重复查找,直到找到返回t ...

  5. Lua查找字符串注意

    问题: 使用Lua写Wireshark插件时,经常匹配字符串.今天使用string.find()函数查找字符串”max-age”,没有找到. 分析: local index = string.find ...

  6. Javascript 查找字符串中出现最多的字符和出现的次数

    <script type="text/javascript"> //查找字符串中出现最多的字符和出现的次数 var str = 'Thatwheneying its o ...

  7. 查找字符串(C++实现)

    查找字符串(C++实现),不使用库函数: // SubString.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include < ...

  8. php查找字符串是否存在

    strstr //搜索字符串在另一字符串中的首次出现(对大小写敏感) //该函数返回字符串的其余部分(从匹配点).如未找到则返回 false stristr //查找字符串在另一字符串中第一次出现的位 ...

  9. linux上查找文件存放地点和文件中查找字符串方法

    一.查找文件存放地点 1.locate 语法:locate <filename> locate命令实际是"find -name"的另一种写法,但是查找方式跟find不同 ...

随机推荐

  1. mysql 存储二进制数据

    晚上小研究了下MySQL存储于读取二进制数据的功能.关键步骤为以下三点: 最重要的一点:存储二进制数据的表的类型需要是blob类型(按长度不同分为tiny, media, long) 插入二进制数据时 ...

  2. zookeeper安装步骤

    zookeeper安装步骤 百度搜索:zookeeper 进入后点击下载: 进入到下载的页面 英文: 中文: 进入版本列表: 进入后复制该链接, 在linux执行wget下载: wget https: ...

  3. 微信小程序开发遇见的问题之一

    在开发的时候,因为要定位到当前的城市,而小程序提供的API只是能够获取当前的经纬度,所以我们需要通过接入百度地图的API.调接口的时候发现报错,说域名不合法,此时千万不要着急,只要你登录你的微信开发公 ...

  4. (转)免费天气预报接口API以及全国所有地区代码!!

    国家气象局提供的天气预报接口 接口地址: http://www.weather.com.cn/data/sk/101010100.html http://www.weather.com.cn/data ...

  5. 微信开发模板--easywechat

    链接地址:https://easywechat.org/zh-cn/docs/installation.html

  6. 如何用Python输出一个斐波那契Fibonacci数列

    a,b = 0, 1 while b<100: print (b), a, b = b, a+b

  7. zabbix-2.4.8-1添加nginx状态监控

    前期准备:nginx在编译是必须要加如下参数: 并且要在nginx的配置文件中添加如下配置: server { listen *: default_server; server_name localh ...

  8. Debussy的安装与使用

    1.概述 Debussy是NOVAS Software, Inc ( 思源科技 )发展的HDL Debug & Analysis tool,这套软体主要不是用来跑模拟或看波形,它最强大的功能是 ...

  9. 模版抽离 优化url

    抽离出base模板 复制index的代码到base里面,指定views里面跳转到base.html,删除掉会变化的保留通用的 把主要内容写写在block里面,写了三个block {% block le ...

  10. FTP主动连接与被动连接

    FTP(File Transfer Protocol, FTP)是TCP/IP网络上两台计算机传送文件的协议,应用层的协议,它基于传输层, FTP是一个8位的客户端-服务器协议,能操作任何类型的文件而 ...