tips javascript(一) 实现type函数用于识别标准类型和内置对象类型,语法如下: var t = type(obj); function type(o){ if (o === null) return 'null'; if (typeof o !== 'object') return typeof o; if (o instanceof Number) return 'number' if (o instanc…
curl请求的url中含有空格时(例如rul的参数是sql查询语句,url=www.tets.com/query.php?sql=select * from t1),curl_easy_perform()将不会得到正确的结果. 需要处理一下空格,用%20替换掉每一个空格,即将select * from t1换成select%20*%20from%20t1…
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </ti…
by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=4562 一.重见天日第二春 11年的时候,写了篇文章“web页面相关的一些常见可用字符介绍”,这篇文章里面藏了个好东西,就是使用一些空格实现个数不等的中文对齐或等宽.见下表: 字符以及HTML实体 描述以及说明 这是我们使用最多的空格,也就是按下space键产生的空格.在HTML中,如果你用空格键产生此空格,空格…
又一个基本概念出问题,参数传递都是值传递, var a={x:10} function test(obj){obj=1} test(a) console.log(a) 输出什么,如果你说1,那就错了,本质上和下面是一样的 var a={x:10} var b=a; b=1; console.log(a) 输出什么,毫无疑问是{x:10}这个Object啊, 这样你就明白了,Javascript里面没有引用传递,都是值传递…
最近,在写一些东西的时候,需要用到CImage类将JPG各式的图片转换成BMP图片,传入的是图片的绝对地址:如C:\Users\Administrator\Documents\Visual Studio 2010\Projects\***\IMAGES\****\0000284n.jpg.但是再用CImage类中Load函数时,始终返回的是错误.所以,我进行了单步调试,才找到原因:原来路径中包含了空格,如图中划红线的部分.因为传入的是char*,所以上网百度了一下,看见了许多方法,如"\&quo…
1.正则去空格 a.去掉字符串中所有空格 " hello world ".replace(/\s+/g,"");//helloworld b.去掉字符串左边空格 var str = " hello world ".replace(/^\s*/g,"");//hello world.. c.去掉字符串右边空格 var str = " hello world ".replace(/\s*$/g,"&q…
To make an array uniqued, we can use Set() from Javascript. const ary = ["a", "b", "c", "a", "d", "c"]; console.log(new Set(ary)); We can see that all the duplicated value have been removed, now…
SELECT * FROM T_NAME WHERE REGEXP_LIKE(COLNAME, '( )+'); SELECT * FROM T_NAME WHERE length(COLNAME) > length(trim(COLNAME)); SELECT * FROM T_NAME WHERE substr(字段,-1)=' ';…