第一种方式
#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. Linux 进程间通信(二)(网络IPC:套接字)

    socket描述符 套接字是通信端点的抽象,创建一个套接字使用如下函数: #include <sys/socket.h> int socket(int domain, int type, ...

  2. Bootstrap学习-其它内置组件

    1.缩略图(一) 缩略图在网站中最常用的地方就是产品列表页面,一行显示几张图片,有的在图片底下(左侧或右侧)带有标题.描述等信息.Bootstrap框架将这一部独立成一个模块组件.并通过“thumbn ...

  3. 【转】Linux系统上安装MySQL 5.5 rpm

    1.准备工作 从MySQL官网上分别下载mysql服务器端于客户端包. 如: MySQL-server-5.5.15-1.linux2.6.x86_64.rpm和MySQL-client-5.5.15 ...

  4. mysql练手

    1.根据图创建下列表格 没有外键的表先创建,创建顺序为teacher,class,course,student CREATE TABLE class ( cid INT NOT NULL auto_i ...

  5. 简述Python的深浅拷贝以及应用场景

    深浅拷贝的原理 深浅拷贝用法来自copy模块. 导入模块:import copy 浅拷贝:copy.copy 深拷贝:copy.deepcopy 字面理解:浅拷贝指仅仅拷贝数据集合的第一层数据,深拷贝 ...

  6. hdu 4956 Poor Hanamichi BestCoder Round #5(数学题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4956 Poor Hanamichi Time Limit: 2000/1000 MS (Java/Ot ...

  7. Mybatis使用pageHelper步骤

    1.在pom.xml中添加如下依赖: <dependency> <groupId>com.github.pagehelper</groupId> <artif ...

  8. Python2 socket 多线程并发 ThreadingTCPServer Demo

    # -*- coding:utf-8 -*- from SocketServer import TCPServer, StreamRequestHandler import traceback cla ...

  9. BGP Basic Knowledge

    声明: 这篇文章是对网上的这几篇博客的摘录,仅供我自己以后看的时候方便,且不需要再看太多的内容, 如果大家对BGP不是很了解,建议看原博客或者直接看RFC     BGP只支持基于目的地址的路由,即路 ...

  10. Eclipse 输出的文本乱码

    Version: Mars.2 Release (4.5.2)Build id: 20160218-0600 在使用时,发现文本编辑器中的文字出现了乱码.然后在项目的Properties->&g ...