PHP中正则表达式的声明格式有两种方式,一种是POSIX老版模式,已经不常用。还有一种是其他语言中常见的PCRE方法。1.正则表达式的匹配方法并返回匹配的项:array preg_grep(string reg,array 被匹配的数组);$reg="/a|b/";$str=array('abcaB...
分类:
Web程序 时间:
2014-07-07 09:00:15
阅读次数:
195
把重复操作作为参数放在循环里面进行时非常低效的。比如:while i < len(str): print str[i]每次循环迭代都要运行len()这个函数,所以可改为如下提高效率:length = len(str)while i < length: print str[i]
分类:
其他好文 时间:
2014-07-07 00:47:19
阅读次数:
185
function StringBuilder() { this._strings_ = new Array;}StringBuilder.prototype.append = function (str) { this._strings_.push(str);};StringBuilde...
分类:
Web程序 时间:
2014-07-07 00:46:42
阅读次数:
248
#hello.pydef sayHello(): str="hello" print(str);if __name__ == "__main__": print ('This is main of module "hello.py"') sayHello()python作为一...
分类:
编程语言 时间:
2014-07-07 00:22:06
阅读次数:
262
最近的MDVR界面开发中,其中的一个网络界面要写一个IP地址转换的函数,如将“192.168.1.1”,转换为“192.168.001.001”,以下函数的功能实现IP地址的格式化输出。static int IPConvert(char *str){ long ipaddr = inet_add.....
分类:
其他好文 时间:
2014-07-05 19:46:28
阅读次数:
401
WebSocket首先新建一个空的文件夹,通过npm安装nodejs-websocket:npm install nodejs-websocket
新建app.js文件:var ws = require("nodejs-websocket");
ws.createServer(function(conn){
conn.on("text", function (str) {...
分类:
Web程序 时间:
2014-07-05 11:02:09
阅读次数:
335
如ab**cd*e12变成 ****abcde12char* foo(char* str, int length){ int i = length-1,j = length-1; while(i >= 0 && j >= 0){ while(i >= 0 && '*' !=...
分类:
其他好文 时间:
2014-07-03 23:52:49
阅读次数:
314
採用jxl.jar包,网上下载,百度一下到出都是。希望能够帮助到大家。接下来直接贴代码:public List getValue(String fileName){ String str=ExcelOparations.readExcel(fileName).trim(); S...
分类:
编程语言 时间:
2014-07-03 22:56:23
阅读次数:
317
1. 函数如下public static string Intern(string str){ if(str == null) { throw new ArgumentNullException("str"); } return Thr...
分类:
其他好文 时间:
2014-07-03 22:11:06
阅读次数:
268
有一个字符串首尾相连(m个字符),有n种字符组成,求一段能使包含n种字符的子串,并使长短最短,时间复杂度要求O(n),空间复杂度O(1)#include int foo(const char* str, int m, int n){ int hit[256], count = 0, begin...
分类:
其他好文 时间:
2014-07-03 20:28:46
阅读次数:
312