0
比方說,我有一個字符串,如function arg1 arg2 "arg3 is long"
。參數字符串
我怎麼能獲得
String[0] = "function"
String[1] = "arg1"
String[2] = "arg2"
String[3] = "arg is long"
比方說,我有一個字符串,如function arg1 arg2 "arg3 is long"
。參數字符串
我怎麼能獲得
String[0] = "function"
String[1] = "arg1"
String[2] = "arg2"
String[3] = "arg is long"
這question的答案有很多你需要探討的輸出,但他們量身打造真正的命令行參數。
你想從那個例子中得到什麼輸出? – jozefg
字符串[]與String [0] =「function」的內容; String [1] =「arg1」; etc – ixchi
[正則表達式用於在不包含單引號或雙引號的情況下使用空格拆分字符串]的可能重複(http://stackoverflow.com/questions/366202/regex-for-splitting-a-string-using-space-when不包圍的單或雙) –