일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- lsusb
- FileSystemObject
- 따라다니는 배너
- println
- RTL88x2BU
- submit
- utf-8
- Getrows
- readonly
- ASP
- SQL Injection
- AC1300
- form
- jquery 레이어
- 크로스 컴파일
- 무선랜카드
- PHP GCM
- javascript
- XMLHTTP
- DS718+
- 커널
- include
- euc-kr
- jQuery
- replace
- ajax
- 시놀로지
- disabled
- Injection
- synology
- Today
- Total
아는 것이 좋은 것이다.
[ASP] 한글, 영문 문자열 자르기 본문
<%
Function simpleCut(ByVal cutString, num) ' 한글,영문을 같이 쓸경우 정확하지 않다
If len(cutString) > num Then
simpleCut = left(cutString,num - 1) & "..."
End If
End Function
Function strCutting(Str, Num)
strLength = 0
For strNum = 1 To Len(str) ' strNum이 0부터 시작하면 오류가 발생한다.
Temp = Asc(Mid(Str, strNum, 1))
strCut = strCut & Mid(Str, strNum, 1)
If Temp < 0 Then '(-) 가 나오면 한글
strLength = strLength + 1.4
Else
strLength = strLength + 1
End If
If strLength >= Num Then ' Num 이상일경우 잘라준다
strCut = strCut & "..."
Exit For
End If
Next
strCutting = strCut
End Function
aa = "변환할 문자열입니다. asdasd!!!!테스트"
Response.write "simpleCut=" & simpleCut(aa, 15) & "<br>" '출력 : simpleCut=변환할 문자열입니다. as...
Response.write "strCutting=" & strCutting(aa, 15) & "<br>" '출력 : strCutting=변환할 문자열입니다. ...
%>
'ASP' 카테고리의 다른 글
[ASP] AJAX 한글 깨짐 해결방법, encodeURI로 변환값 ASP로 디코딩(한글깨짐 방지) (0) | 2014.07.10 |
---|---|
[ASP] form utf-8 -> euc-kr 로 변환하여 전송 (0) | 2014.07.08 |
[ASP] 숫자 앞에 원하는 개수만큼 0 붙이기 (1) | 2014.07.06 |
[ASP] XML 읽어서 출력 (0) | 2014.06.28 |
[ASP] 변수로 인클루드(include) 하기 (0) | 2014.06.23 |