memstr

 //find 'substr' from a fixed-length buffer
//('full_data' will be treated as binary data buffer)
//return NULL if not found
char* memstr(char* full_data, int full_data_len, char* substr)
{
if (full_data == NULL || full_data_len <= || substr == NULL) {
return NULL;
} if (*substr == '\0') {
return NULL;
} int sublen = strlen(substr); int i;
char* cur = full_data;
int last_possible = full_data_len - sublen + ;
for (i = ; i < last_possible; i++) {
if (*cur == *substr) {
//assert(full_data_len - i >= sublen);
if (memcmp(cur, substr, sublen) == ) {
//found
return cur;
}
}
cur++;
} return NULL;
}

memfind

 char* memstr(char* full_data, int full_data_len, char* substr, int substr_len)
{ }

mem中需找特定字符的更多相关文章

  1. jquery判断字符串中是否包含特定字符的方法总结

    方法一:使用indexOf() 和lastIndexOf()方法 案例: var Cts = "bblText"; if(Cts.indexOf("Text") ...

  2. python中实现打印特定字符变换

    首先需要将 lib文件 放在该文件同一目录 使用的时候,先导入 from lib.common import print_msg ,然后调用里面的 print_msg() 方法即可! lib文件地址: ...

  3. 如何替换某文件中的所有的特定字符?---linux sed命令(文本编辑命令) (转载)

    转自:http://blog.csdn.net/year_9/article/details/20318407 sed是一个很好的文件处理工具,主要是以行为单位进行处理,可以将数据行进行替换.删除.新 ...

  4. Python字符串中添加、插入特定字符

    分析 我们将添加.插入.删除定义为: 添加: 在字符串的后面或者前面添加字符或者字符串 插入: 在字符串之间插入特定字符 在Python中,字符串是不可变的.所以无法直接删除.插入字符串之间的特定字符 ...

  5. Python字符串中删除特定字符

    分析 在Python中,字符串是不可变的.所以无法直接删除字符串之间的特定字符. 所以想对字符串中字符进行操作的时候,需要将字符串转变为列表,列表是可变的,这样就可以实现对字符串中特定字符的操作. 1 ...

  6. 如何在大量jar包中搜索特定字符

    欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...

  7. JS正则表达式获取字符串中特定字符

    JS正则表达式获取字符串中得特定字符,通过replace的回调函数获取. 实现的效果:在字符串中abcdefgname='test'sddfhskshjsfsjdfps中获取name的值test  实 ...

  8. C++从string中删除所有的某个特定字符

    C++中要从string中删除所有某个特定字符, 可用如下代码 str.erase(std::remove(str.begin(), str.end(), 'a'), str.end()); 其中, ...

  9. ref:如何在大量jar包中搜索特定字符

    ref:https://www.cnblogs.com/jiangxinnju/p/5137760.html?utm_source=tuicool&utm_medium=referral 如何 ...

随机推荐

  1. ImageLoader_ _Universal-Image-Loader完全解析(一)之介绍与使用详解

    转载请标明出处: http://blog.csdn.net/developer_jiangqq/article/details/50439814 本文出自:[江清清的博客] (一).前言: 已经半个月 ...

  2. html_

    =============  博客大全: 脚本之家:http://www.jb51.net/list/list_233_104.htm 红黑联盟: http://www.2cto.com/kf/yid ...

  3. ylbtech-Unitity-cs:计算阶乘值

    ylbtech-Unitity-cs:计算阶乘值 1.A,效果图返回顶部   1.B,源代码返回顶部 1.B.1, using System; namespace Functions { public ...

  4. Porlet标准:JSR168/JSR286/WSRP(转载)

    From:http://www.iteye.com/topic/620213 Portlet标准主要是JSR168,JSR286和WSRP. JSR168因为比较早,所以大部分的Portal都支持这个 ...

  5. python爬取并计算成绩

    模拟登录后抓取成绩,计算绩点. # -*- coding: utf-8 -*- import urllib import urllib2 import cookielib import re impo ...

  6. [Java] 过滤流BufferedInputStream和BufferedOutputStream

    package test.stream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import ...

  7. dubbo的代码项目结构

    dubbo 的项目(Project)包含下面模块(Module): 这些模块的功能描述如下: dubbo-admin  dubbo的管理平台 dubbo-demo  包含生产者.消费者.接口定义的du ...

  8. types.MethodType

    http://stackoverflow.com/questions/972/adding-a-method-to-an-existing-object-instance 532down voteac ...

  9. Linux命令 find和mv的结合使用:查找文件,移动到某个目录

    显示前十个文件 [root@localhost smgpbi]# ls -1 | sort -u | head -10 1.首先查看文件个数,进入所在的文件 # find . -name " ...

  10. ListView中使用type需要注意的东西

    在使用ListView时,如果使用了getItemViewType, 记得他的值一定要是从0开始计数的. 且要覆盖getViewTypeCount方法.并且让getViewTypeCount>g ...