收集了一份php正则表达式的实例教程,真心不错,记录下。正则表达式用于字符串处理、表单验证等场合,实用高效。一些常用的表达式:$str = preg_replace("/()(.*?)()/", '\1\2\3', $str);其中用了三个子模式(每个圆括号中内容为一个子模式),第一个是链接开始标签...
分类:
其他好文 时间:
2014-09-25 19:11:17
阅读次数:
365
int i,n=0; String[] words; String str="dd,gg,kk,ss,tt"; for(i=0;i<str.length();i++){ if(str.charAt(i)==',') n++; } System.out.println(n); ...
分类:
数据库 时间:
2014-09-25 18:51:27
阅读次数:
234
ChineseInput.c
#include
#include
#include "PY_Index.h"
unsigned char * search_Chinese(char *buf)
{
static char str[50]={""};
int i=0;
strcpy(str,"PY_mb_");
strcat(str,buf);
for(i=...
分类:
其他好文 时间:
2014-09-25 18:50:37
阅读次数:
812
代码只是给了思想,勿喷 var?a?=?"0123456789abcdef";
var?b?=?0;
var?str?=?"#";
for(var?i=0;?i<6;?i++)?{
????b?=?Math.floor(Math.random()*16);
????str?+=?a[b];
}
console.log(s...
分类:
Web程序 时间:
2014-09-25 17:46:57
阅读次数:
142
Calendar cal = Calendar.getInstance();
cal.get(Calendar.DAY_OF_MONTH);
cal.get(Calendar.MONTH);
cal.get(Calendar.YEAR);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
Str...
分类:
其他好文 时间:
2014-09-25 16:26:29
阅读次数:
208
使用字符串指针变量与字符数组的区别(1)分配内存 设有定义字符型指针变量与字符数组的语句如下: char *pc ,str[100]; 则系统将为字符数组str分配100个字节的内存单元,用于存放100个字符。而系统只为指针变量pc分配4个存储单元,用于存放一个内存单元的地址。(2)初始化赋值...
分类:
其他好文 时间:
2014-09-25 02:53:27
阅读次数:
204
参数策略 如果函数的参数是一个指针,不要指望用该指针去动态申请内存。如下: void GetMemory(char *p, int num)
{ p = (char *)malloc(sizeof(char) * num);
}
void Test(void)
{ char *str = NULL;...
分类:
其他好文 时间:
2014-09-24 23:23:01
阅读次数:
170
题意:给一个长n(n a[i-1],则删除a[i-1]。我暴力的用链表实现了……#include #include #include #include using namespace std;#define N 100020char str[N];int main() { int n, d; ...
描述:一个英文句子仅由单词、逗号、句号、空格组成。要求过滤句子中的重复单词,例如:输入where there is a will, there is a way.输出:where there is a will waystr = raw_input("");a = []str = str.repla...
分类:
编程语言 时间:
2014-09-24 22:05:17
阅读次数:
473
经常会遇到时间转换的,在此收藏一个时间换算的方法? 1 #pragma mark 时间换算 2 3 + (NSString *)setcreateTime:(NSString *)str 4 { 5 //yyyy-MM-dd- HH:MMss"]; 6 7 8 NSDa...
分类:
移动开发 时间:
2014-09-24 20:47:27
阅读次数:
263