用正則表示式取代。
正則表示式:"\s+"
注意反斜線!
目前分類:程式設計 (6)
- Dec 13 Wed 2017 11:24
如何清除字串中的所有的white-space?
- Jun 27 Tue 2017 15:11
[JavaScript] 執行順序 / 擺放位置
(1) W3C 建議放在 <head></head> 中。
(2) 不論擺在哪裡,都是從頭讀到尾的執行順序。(call function除外)
(3) jquery可以放在head中;jquery會綁定一個監聽,當全部的html文檔解析完之後,再執行內部代碼。
- Mar 09 Thu 2017 16:03
日期時間 標準格式 - ISO 8601
- Feb 08 Wed 2017 09:35
[程式][Java] Java Singleton
範例:
public class AutoStudent { // Singleton private static AutoStudent instance = null ; public static AutoStudent getInstance() { if ( instance == null ) { synchronized ( AutoStudent.class ) { if ( instance == null ) { instance = new AutoStudent(); } } // synchronized } return instance; } // getInstance() private AutoStudent() { } } // public class AutoStudent
- Jan 18 Wed 2017 15:29
Open-Closed Principle
OCP: the Open-Closed Principle
Software entities (class, modules, functions, etc.) should be open for extension, but closed for modification.
一個軟體個體應該要夠開放使得它可以被擴充,但是也要夠封閉以避免不必要的修改。這樣解釋鄉民們應該還是看不懂,接著看 Robert 在書中所說得這段話就會很清楚了 (p. 99):
When a single change to a program results in a cascade of changes to dependent modules, the design smells of Rigidity. The OCP advises us to refactor the system so that further changes of that kind will not cause more modifications. If the OCP is applied well, then further changes of that kind are achieved by adding new code, not by changing old code that already works.
- Dec 16 Wed 2015 10:22
[程式][C#] C# Singleton