常用的内置函数1、split语法:split(string,array[,fieldsep[,seps]])功能:将string表示的字符串以fieldsep为分隔符进行分隔,并将分隔后的结果保存至array为名的数组中;数组下标为从1开始的序列;[root@xxx~]#df-h|awk‘!/^File/{split($5,USE,"%");printUSE[1]}‘
17
0
7
7
[..
分类:
其他好文 时间:
2015-09-25 14:38:45
阅读次数:
203
import socket,struct,sys,getopt,string
def doAnalysis(ifile, ofile):
infile = open(ifile, ‘r‘)
onfile = open(ofile, ‘w‘)
for line in infile.readlines():
info = line.split(‘\t‘)...
分类:
编程语言 时间:
2015-09-25 13:25:41
阅读次数:
186
strip函数原型声明:s为字符串,rm为要删除的字符序列s.strip(rm) 删除s字符串中开头、结尾处,位于rm删除序列的字符s.lstrip(rm) 删除s字符串中开头处,位于rm删除序列的字符s.rstrip(rm) 删除s字符串中结尾处,位于rm删除序列的字符注意:1. 当rm为空时,默...
分类:
编程语言 时间:
2015-09-25 11:04:48
阅读次数:
121
查了下api文档:发现StringTokenizer是出于兼容性的原因而被保留的遗留类(虽然在新代码中并不鼓励使用它)。建议所有寻求此功能的人使用String的split方法或 java.util.regex 包。既然已经不必提倡,代码尽量不要用这些;还是简单了解下用法:一般是3个方法一起用,迭代:...
分类:
其他好文 时间:
2015-09-24 14:36:17
阅读次数:
205
输出中文内容报错如下: self.status.split(‘ ‘,1)[0], self.bytes_sent 需要指定返回编码: return?[stdout.getvalue().encode("gbk")] 参考:http://stackoverflow.com/questions/21059640/wsgiref-error-att...
分类:
编程语言 时间:
2015-09-23 19:43:42
阅读次数:
354
public static void main(String[] args) { String str="&emailCheckURL=447&useremail=vip@cxais.com&porm=p"; String[] splitURL=str.split...
分类:
编程语言 时间:
2015-09-23 16:43:33
阅读次数:
225
直接看代码吧#获取文件path路径中文件名(去掉目录路径)sub get_file_basename{ my ($file_path) = @_; my @tmp_arr = split(/[\\|\/]+/,$file_path); my $len = @tmp_arr; if ($len >=2...
分类:
其他好文 时间:
2015-09-23 14:58:16
阅读次数:
145
functionrequest(paras){varurl=location.href;varparaString=url.substring(url.indexOf("?")+1,url.length).split("&");varparaObj={}for(i=0;j=paraString[i]...
分类:
Web程序 时间:
2015-09-23 14:53:54
阅读次数:
175
Problem DescriptionClarke is a patient with multiple personality disorder. One day, Clarke split into two personality a and b, they are playing a game...
分类:
其他好文 时间:
2015-09-22 20:31:55
阅读次数:
222
数组与字符串的相互转化 <script type="text/javascript"> var obj="new1abcdefg".replace(/(.)(?=[^$])/g,"$1,").split(",");?????? //字符串转化为数组 var obj2 = "new2abcdefg".split("");??????...
分类:
编程语言 时间:
2015-09-22 13:09:41
阅读次数:
222