tntasdf's recent timeline updates
tntasdf

tntasdf

V2EX member #114724, joined on 2015-05-02 15:31:28 +08:00
tntasdf's recent replies
Aug 4, 2015
Replied to a topic by xiaobetty 推广 晒出你最蠢的一段代码,送 Cherry 鼠标垫
```
// js - 找出数组中的最大值
var a=[1,45,78,654,3,6,311];
var t=a[0];

if(t<a[1]) {
t=a[1];
}

if(t<a[2]) {
t=a[2];
}

if(t<a[3]) {
t=a[3];
}

if(t<a[4]) {
t=a[4];
}

if(t<a[5]) {
t=a[5];
}

if(t<a[6]) {
t=a[6];
}

// .... 不能要求更多...

console.log(t);

```
尽管吸引了点击,但同时也败了人品。正所谓鱼和熊掌不可兼得,不过LZ还是胜了一筹。
Jun 17, 2015
Replied to a topic by 1oscar Python 正则大神,一个正则问题
写的是php , python不懂多少 。 主要看正则,大致是可以移植的。PHP中需要[^\x00-\x80]来匹配中文,python的话应该是其他, 另外就是非贪婪模式了。
Jun 17, 2015
Replied to a topic by 1oscar Python 正则大神,一个正则问题
// PHP

$str="Tyrsovo Nám., 252 63 布拉格, 捷克共和国
Via Augusta 127, 8006 巴塞罗那, 西班牙
Victoria Regina Square 11-12, 1210 布鲁塞尔 - Botanique, 比利时";

preg_match_all('/([^\x00-\x80]+?)(,|\s-)/',$str,$mts); // 更不规则的,改括号2的正则

print_r($mts); // $mts[1] 就是了


事实上不需要拘泥于一个正则搞定,可以先做字符串处理。正则规则写得越复杂,效率越慢。
Jun 12, 2015
Replied to a topic by w88975 程序员 钱是存理财产品,还是入股市搏一搏呢?
人生恐怕不会碰到几个牛市了。少年,不来一发?
May 25, 2015
Replied to a topic by seeker 程序员 有参加 2015 谷歌 IO 的 v 友一起玩耍不?
LZ 桶粉
May 25, 2015
Replied to a topic by geew 程序员 说说你最近生活的关键词吧
代码,文档,足球,台球,羽毛球,南方公园,游戏,吉他,音乐,茶,烟.....
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1606 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 16:16 · PVG 00:16 · LAX 09:16 · JFK 12:16
♥ Do have faith in what you're doing.