Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string text = "マルチバイト文字";
- int size = 10; // 10バイト
- Encoding e = System.Text.Encoding.GetEncoding("Shift_JIS");
- string result = new String(text.TakeWhile((c, i) => e.GetByteCount(text.Substring(0, i + 1)) <= size).ToArray());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement