echo ""; echo "笔试题测试"; $str = "123456780"; $str = strrev($str); //将字符串倒序排列 echo strlen($str); if(strlen($str)%2 != 0){ $arr = str_split($str); //分给...
分类:
Web程序 时间:
2014-12-13 11:58:43
阅读次数:
192
split用于分割字符串得到字串数组这是基本用法。如下: def str= "3 2" if(str.contains(" ")){ println str.split(' ')[0] // 3 } 可是换一种情况: def str= "3+2" if(str.contains("+")){ pri...
分类:
其他好文 时间:
2014-12-13 10:43:32
阅读次数:
210
function gettypes(){//动态生成select内容var str="";$.ajax({type:"post",async:false,url:"checkpersontype",success:function(data){if (data != null) { var js.....
分类:
其他好文 时间:
2014-12-13 09:35:14
阅读次数:
352
0.57s,
import itertools
import time
def conquer():
ans = 0
DIGIT_LIMIT = 7
ITER_STR = "0123456789"
sum_square = lambda ss: sum( int( s ) ** 2 for s in str( ss ) )
fact = lambda n...
分类:
其他好文 时间:
2014-12-12 22:15:46
阅读次数:
247
字符串操作:
int consecutiveCharMaxCount( char *str)
{
char *pstr = NULL;
char *p = NULL;
int value = 0;
int incN = 1;
int decN = 1;
int maxCount = 0;
char chrp = 0;
char chrn = 0;
if(str =...
分类:
其他好文 时间:
2014-12-12 19:17:57
阅读次数:
211
C语言提供了几个标准库函数,可以将字符串转换为任意类型(整型、长整型、浮点型等)的数字。以下是用atoi()函数将字符串转换为整数的一个例子:# include # include void main (void) ;void main (void){ int num; char * str = "...
分类:
编程语言 时间:
2014-12-12 18:53:06
阅读次数:
179
最近需要在SQL的字符串中截取汉字,利用unicode函数判断字符的unicode编码,根据编码范围过滤掉非汉字字符。写成了一个function/*@str 需要获取汉字的字符串*/create function CharRep(@str nvarchar(200)) returns nvarcha...
分类:
数据库 时间:
2014-12-12 18:34:45
阅读次数:
185
函数的值传递//由于函数是对象,所以可以直接把函数参数传递进来function callFun(fun,arg){ //第一个参数就是函数对象 return fun(arg);}function sum(num){ return num +100;}function say(str...
分类:
其他好文 时间:
2014-12-12 18:19:28
阅读次数:
153
#!/usr/bin/pythonimportMySQLdbimportpycurldefmaster_work(ip,port):printip,portconn=MySQLdb.connect(host=str(ip),user=‘***‘,passwd=‘****‘,port=int(port))cur=conn.cursor(cursorclass=MySQLdb.cursors.DictCursor)cur.execute(‘showstatus;‘)result=cur.fetchall()#co..
分类:
数据库 时间:
2014-12-12 17:06:30
阅读次数:
241
#!/usr/bin/pythonimportpycurlimportosimportMySQLdbimportcStringIOimportsimplejsonimportredisdeffts_get_appname(host,user,port,db,passwd):conn=MySQLdb.connect(host=str(host),user=user,passwd=passwd,port=int(port),db=db)cur=conn.cursor(cursorclass=MySQLdb.cur..
分类:
其他好文 时间:
2014-12-12 17:05:27
阅读次数:
198