// 超過 10bytes 則截斷 例: title= 超過 10bytes 則截斷 var titlebytes = title.Length; var minbyts = 10; for (var i = 0; i < title.Length; i++) if (((int)title[i]) > 127) { titlebytes++; minbyts--; } //(轉換) 中文字為 2 位元 if (titlebytes > 10) { title = title.Substring(0, minbyts); } else { title = title.Substring(0, title.Length); } // 截斷多餘文字 結果: 超過 10byte