字串:var s = "1,2,3,4,5," 目標:刪除最後一個 "," 方法:s=s.substring(0,s.Length-1); 字串:var s2 = "img/upload/123.jpg" 目標:取得檔案名稱(不包含後綴名) 方法:s2=s2.substring(s2.lastIndexOf('/') 1, s2.lastIndexOf('.'));