Java的String物件中,有個split function,
平常使用String.split("分隔字串")均可以將字串做分隔,
但,當原字串中,尾端若有連續出現的"分隔字串"時,
卻會被忽略。
例:
"a,b,c,d".split(",") = [a, b, c, d]
"a,b,c,d,,,".split(",") = [a, b, c, d]
但若改為
"a,b,c,d,,,".split(",", -1) = [a, b, c, d, "", "", ""]
原因為
"a,b,c,d,,,".split(",") = "a,b,c,d,,,".split(",", 0)
於是,尾端的空白值都會被忽略。
Java API Doc裡有提到:
This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
Anderson's Clipboard
2015年11月10日 星期二
2015年10月1日 星期四
2015年5月11日 星期一
Oracle listagg distinct
select col1,
regexp_replace(
listagg(col2, ',') within group (order by col2)
,'([^,]+)(,\1)+', '\1')
where rn = 1
group by col1;
ref from here
2015年3月27日 星期五
Oracle connection數上限 - 查詢
--The number of sessions the database was configured to allow
SELECT name, value
FROM v$parameter
WHERE name = 'sessions';
--The number of sessions currently active
SELECT COUNT(*)
FROM v$session;
2014年12月31日 星期三
2014年12月30日 星期二
解決:ORA-01000: maximum open cursors exceeded
先看看目前可用的數量是多少
show parameter open_cursors;
進行修改
alter system set open_cursors=1000 scope=both sid='*';
Oracle建議值為500
2014年8月8日 星期五
改win7的預設動態tcp port範圍
用netsh這個命令,可以從命令中的help得到用法
netsh interface ipv4 set dynamicportrange tcp 10000 10000
訂閱:
文章 (Atom)