看板 C_Sharp 關於我們 聯絡資訊
StreamReader sr = new StreadReader(inputfile); String content = sr.ReadLine(); if (content.ToUpper().Trim() == "T") 這個code是要找這個inputfile裡面開頭是"T"的 請問一下這個 content.ToUpper().Trim() 會retrun一個字嗎還是一個String 我看Libarary裡面寫的應該是回傳這個字串都變成大寫然後前後空白消掉 那如果是String的話應該要用equal這個method來看吧? 所以應該要是 content.ToUpper().Trim().equals(T) 這樣嗎? 還有就是如果第一行不只一個字的話 那這個if就不會成立的是不是? -- 嘴筋那麼厲害 幹麻不去選總統 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.217.83.240
bensontsai:content.ToUpper().Trim().StartsWith("T") 140.112.30.250 06/22
comput:沒有那個method阿~@@ string裡面 203.217.83.240 06/22
bensontsai:怎麼我的有..?..@@a 140.112.30.250 06/22
kojilin:搭配Split吧.. 140.138.150.48 06/22