为啥要用正则?!我最开始也不是很理解,说实话也懒得学,但看看下面的if else 估计各位也是够了,虽然正则难学,难记总归类似这种操作应该是用正则去做的。下面我用传统字符串操作做一个取数字的函数。//函数findNum的任务 是找到字符串"1212 21 009 090 00"并打印出来va...
分类:
Web程序 时间:
2014-11-04 10:47:30
阅读次数:
181
替换字符串str =str.replace(/\;/g, ",");//将分号替换成逗号删除第一个字符 str=str.substr(1);//删除字符串第一个字符删除最后一个字符str=str.substring(0,str.length-1); //删除字符串最后一个字符
分类:
其他好文 时间:
2014-11-04 10:46:55
阅读次数:
116
主要内容:字符串内存分配、合并两个字符串
#include
#include
int main(int argc, char *argv[])
{
/*
* 字符串操作:内存分配
* 字符串s和t,希望将这两个字符串连接成单个字符串r
*/
char* s = "abc";
char* t = "def";
// 方法一: 缺点:1、不能确定r指向何处;2、同...
分类:
编程语言 时间:
2014-11-03 22:33:51
阅读次数:
260
新版本python安装目录 /usr/local/python3# ./configure --prefix=/usr/local/python3# make && make install# mv /usr/bin/python /usr/bin/python_old #把旧版本的p...
分类:
编程语言 时间:
2014-11-02 22:20:28
阅读次数:
212
首先在官网下载:http://www.crummy.com/software/BeautifulSoup/#DownloadBeautifulSoup在版本4以上都开始支持python3了,所以就下最新的吧。不过,在安装之前,首先要把这里的代码全部由python2格式转换成python3格式。这个工...
分类:
编程语言 时间:
2014-11-02 16:13:34
阅读次数:
235
以前的python2.x的时候:try:fp=urllib.request.urlopen(blogurl)exceptException,e:print(e)print('downloadexception%s'%blogurl)return0现在python3.x的时候:try:fp=urlli...
分类:
编程语言 时间:
2014-11-02 10:44:11
阅读次数:
209
// Playground - noun: a place where people can playimport UIKit//import Foundationvar str = "Hello, playground"//swift 新运算符 Nil Coalescing Operator (....
分类:
编程语言 时间:
2014-10-31 15:34:18
阅读次数:
122
这篇文章主要介绍了相比于python2.6,python3.0的新特性。更详细的介绍请参见python3.0的文档。Common Stumbling Blocks本段简单的列出容易使人出错的变动(初学者应该注意)。print语句被print()函数取代了,可以使用关键字参数来替代老的print特殊语...
分类:
编程语言 时间:
2014-10-31 15:18:22
阅读次数:
300
在看《深入PHP和JQeury开发》过程中,遇到字符串 操作符HeredocA third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, the.....
分类:
Web程序 时间:
2014-10-31 11:22:45
阅读次数:
173
在 python2 中zip可以将两个列表并入一个元组列表,如:a = [1,2,3,4]b = [5,6,7,8]c = zip(a,b)结果:c [(1,5),(2,6),(3,7),(4,8)]在python3中zip返回值有所改变:>>> a = [1,2,3,4]>>> b = [5,6,...
分类:
编程语言 时间:
2014-10-30 22:30:41
阅读次数:
216