1. 最笨的办法.......function get() { var s = 22.127456 + ""; var str = s.substring(0,s.indexOf(".") + 3); alert(str); }2. 正则 效果不错3. 他就比较聪明了.....4.会用新鲜东西的.....
分类:
Web程序 时间:
2014-07-03 10:39:46
阅读次数:
205
1.区别wchar_t,char,WCHAR ANSI:即 char,可用字符串处理函数:strcat( ),strcpy( ), strlen( )等以str打头的函数。 UNICODE:wchar_t是Unicode字符的数据类型,它实际定义在里: typedef unsigned short ...
分类:
其他好文 时间:
2014-07-03 10:36:28
阅读次数:
230
函数: 1、从左开始截取字符串 left(str, length) 说明:left(被截取字段,截取长度) 例:select left(content,200) as abstract from my_content_t 2、从右开始截取字符串 right(str, length) 说明:right...
分类:
数据库 时间:
2014-07-03 09:58:51
阅读次数:
238
Python数据类型之间的转换函数描述int(x [,base])将x转换为一个整数long(x [,base] )将x转换为一个长整数float(x)将x转换到一个浮点数complex(real [,imag])创建一个复数str(x)将对象 x 转换为字符串repr(x)将对象 x 转换为表达式...
分类:
编程语言 时间:
2014-07-03 09:48:00
阅读次数:
217
引自http://www.blogjava.net/dreamstone/archive/2007/03/04/101733.aspx一种比较好理解的说法类-->对象-->实例人类是类某个人是对象你是实例实例本身也是对象。表现出来是这样的String 类String str str是对象String...
分类:
其他好文 时间:
2014-07-03 00:47:49
阅读次数:
232
1. TypeError: string indices must be integers, not str字符串类型取第index个字符的时候,应该传入int而不是str。如1a='abcdef'2printa[0]3#而不是 print a['0']更常见的情况是把一个string当成了字典在使...
分类:
其他好文 时间:
2014-07-03 00:36:01
阅读次数:
746
String.indexOf的模拟实现,没想象中有多么高深的查找算法,就是最普通的遍历查找思路:先找到第一个相同的字符,然后依次比较后面的字符,若都相等则表示查找成功 /** * 查找字符串pattern在str中第一次出现的位置 * @param str * @par...
分类:
其他好文 时间:
2014-07-02 21:23:28
阅读次数:
223
$("#btn5").click(function() { var str="";$("[name='checkbox'][checked]").each(function() '用来获取数组{ str+=$(this).val()+","; '用来遍历数组 //alert($(this).val....
分类:
Web程序 时间:
2014-07-01 17:14:45
阅读次数:
246
题目大意:
问[s,e]之间有多少个 斐波那契数。
思路分析:
直接模拟高精度字符串的加法和大小的比较。
注意wa点再 s 可以从 0 开始
那么要在判断输入结束的时候注意一下。
#include
#include
#include
#include
using namespace std;
struct node
{
char str[111];
...
分类:
其他好文 时间:
2014-07-01 16:08:10
阅读次数:
243
题意:排序后字符串全排列
思路:好久没水一题了
#include
#include
#include
#include
using namespace std;
const int MAXN = 220;
char str[MAXN];
int main() {
while (scanf("%s", str) != EOF) {
int n = strlen(str);
...
分类:
其他好文 时间:
2014-07-01 15:09:17
阅读次数:
182