字符串转数组$str = 'one|two|three|four';print_r(explode('|', $str)); //explode 以字符串分割字符串到数组$str = 'one two three'; //str_split 以位数分割$arr1 = str_spli...
分类:
编程语言 时间:
2015-09-09 11:29:58
阅读次数:
139
对下面代码的一些细节,解释下为什么那么做。 1.? char?buf[sizeof(int)?*?8?+?1]?=?""; 这个buf的作用是缓存中间结果,长度没有写死。好处是不同的平台上这段代码都可以执行。 2. if?(base?<?2?||?...
分类:
编程语言 时间:
2015-09-08 09:47:24
阅读次数:
190
函数 : FROM_UNIXTIME(unix_timestamp,format) 时间戳转字符串日期格式%M 月名字(January……December)%W 星期名字(Sunday……Saturday)%D 有英语前缀的月份的日期(1st, 2nd, 3rd, 等等。)%Y 年, 数字, 4 位...
分类:
数据库 时间:
2015-09-07 12:24:52
阅读次数:
237
字符串转对象(strJSON代表json字符串) var obj = eval(strJSON); var obj = strJSON.parseJSON(); var obj = JSON.parse(strJSON);json对象转字符串(obj代表json对象) var str = o...
分类:
Web程序 时间:
2015-09-07 09:35:13
阅读次数:
305
汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运算结果。对于一个给定的字符序列S,请你把其循环左移K位后的序列输出。例如,字符序列S=”abcXYZdef”,要求输出循环左移3位后的结果,即“XYZdefabc”。是不是很简单?OK,搞定它!思路:三次...
分类:
其他好文 时间:
2015-09-02 01:48:47
阅读次数:
213
字符串翻转,单词内不翻转。如IamfromChongqing->ChongqingfromamI 1 #include 2 #include 3 #include 4 5 void reverse(char *str, int beg, int end); 6 void reverseSentec....
分类:
其他好文 时间:
2015-09-01 21:32:40
阅读次数:
189
写此方法的目的是,我想把一个PHP数组配置文件读进程序,添加些配置,然后在写入文件;var_export 方法会把原来的配置打乱(比如数组序号我没有加,他自动给我加上 0,1,2,3...),而且格式不好看(缩进非常难看)。方法及应用array( 'class'=>'system.gii.GiiM....
分类:
编程语言 时间:
2015-09-01 13:53:36
阅读次数:
198
日期时间脚本库方法列表Date.prototype.isLeapYear判断闰年Date.prototype.Format日期格式化Date.prototype.DateAdd日期计算Date.prototype.DateDiff比较日期差Date.prototype.toString日期转字符串D...
分类:
Web程序 时间:
2015-09-01 13:50:50
阅读次数:
139
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 反转字符串{ class Program { static void Main(strin...
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 实现字符串的返转{ class Program { static void Main(st...