티스토리 뷰
이렇게 정의 해놓고 쓴다면 훨씬 편한듯 하네요.
ex)아래 형식을 확인해 보면 값이 = Strin..으로 나오게 됩니다.
string str_string = StringCutByte("String이다.", 10, "..");
protected string StringCutByte(string str, int i_ByteCount, string str_attach)
{
if (i_ByteCount< 3)
throw new ArgumentOutOfRangeException("i_ByteCount");
StringBuilder sb = new StringBuilder(i_ByteCount);
foreach (char c in str)
{
sb.Append(c);
int count = System.Text.Encoding.Default.GetByteCount(sb.ToString());
if (count > i_ByteCount)
{
sb.Remove(sb.Length - 1, 1);
while (System.Text.Encoding.Default.GetByteCount(sb.ToString() ) > i_ByteCount&& sb.Length > 0)
{
sb.Remove(sb.Length - 1, 1);
}
sb.Append(str_attach);
break;
}
}
return sb.ToString();
}
- 집밥
- 서울 데이트
- 지진
- 함수
- clr
- ASP
- 엔플라잉
- 백종원
- 장범준
- ASP.NET
- 지진속보
- 마이리틀
- 서울데이트 코스
- MSSQL
- c#
- JavaScript
- 볼빨간사춘기
- MS-SQL
- 데이트
- 자바스크립트
- 서울 데이트코스
- SQL
- 집밥 백선생
- 레시피
- 4차산업혁명
- 화재
- 백선생
- DateTime
- C#기초
- 집밥백선생
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Total
- Today
- Yesterday