String split方法在忽略參數大小的情況下取得String[]的小技巧
摘要: select * from tableA union select * from tableB
要根據關鍵字把兩個查詢語句分解出來,即得到
select * from tableA 和 select * from tableB
但因為這個是SQL語句,union關鍵字不區分大小寫的,所有sql語句有這些情況:
select * from tableA UNION select * from tableB
select * from tableA UnIOn select * from tableB
select * from tableA UNiON select * from tableB
……
所以單單用這樣的語句:String sql2[]=sql.split(" union ");
是分解不出子語句的。
閱讀全文
posted @
2008-05-04 10:13 蔣家狂潮 閱讀(2221) |
評論 (5) 編輯