Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- MS-SQL
- Unity
- PER
- PyQt5
- swift
- python
- GIT
- Excel
- MySQL
- 라즈베리파이
- 날짜
- tensorflow
- pandas
- 리눅스
- 다이어트
- port
- mssql
- node.js
- IOS
- ubuntu
- 유니티
- ASP
- Linux
- sqlite
- javascript
- 맛집
- PyQt
- flutter
- urllib
- 함수
Archives
아미(아름다운미소)
[asp] 유용함수 정리 본문
[asp] 유용함수 정리
'' 'HTML 태그제거 ' Function StripTags( htmlDoc ) Dim rex Set rex = New Regexp rex.Pattern= "<[^>]+>" rex.Global=True StripTags =rex.Replace(htmlDoc,"") End Function '=========================================================================== '함수명 : DB_IN_STR 'INPUT : cur_str ==> 검사할 문자열 '기능설명 : DB입력할때 ' 만 '' 로 교체 '=========================================================================== Function DB_IN_STR(cur_str) If Not isNull(cur_str) Then cur_str = replace(cur_str,"''","'") End If DB_IN_STR = cur_str End Function ' -------------------------------------------------------- ' Function Name : autoLink ' Description : 문자열내 자동링크 걸기 ' Example : ' output : ' -------------------------------------------------------- Function autoLink( ByVal str ) Dim reg Set reg = New RegExp reg.pattern = "(\w+):\/\/([a-z0-9\_\-\./~@?=%&\-]+)" reg.Global = True reg.IgnoreCase = True str = reg.Replace(str, "$1://$2") autoLink = str End Function ' -------------------------------------------------------- ' Function Name : isVaildProfileImage ' Description : 해당파일이 이미지 파일인지 체크 ' Example : ' output : ' -------------------------------------------------------- Function isVaildProfileImage( ByVal imageName ) Dim imageExt imageExt = LCase(Mid(imageName,InStrRev(imageName,".")+1)) If imageExt <> "jpg" And imageExt <> "gif" And imageExt <> "jpeg" And imageExt <> "bmp" And imageExt <> "jpe" Then isVaildProfileImage = False Else isVaildProfileImage = True End If End Function ' -------------------------------------------------------- ' Function Name : SetDomainCookie ' Description : Cookie 값 설정 ' Example : ' output : ' -------------------------------------------------------- Sub SetDomainCookie(ByVal key, ByVal val, ByVal domain) Response.Cookies(key) = val IF domain <> "" THEN Response.Cookies(key).Domain = domain Response.Cookies(key).Path = "/" END IF End Sub ' -------------------------------------------------------- ' Function Name : MakeTempPwd ' Description : 임시비밀번호 ' Example : ' output : ' -------------------------------------------------------- Sub MakeTempPwd(ByRef pwd) Randomize Timer Const StringTable = ("0123456789abcdefghijklmnopqrstuvwxyz") For i = 1 To 7 pwd = pwd & Mid(StringTable, Int(Rnd(1)*Len(StringTable))+1,1) Next End Sub ' -------------------------------------------------------- ' Function Name : FillChar ' Description : 필요한 자리수만큼 특정문자로 채우기 ' Example : Response.Write FillChar(원본값,채울값,방향,자릿수) ' output : ' -------------------------------------------------------- Function FillChar(strValue, FChar, Direction, strLength) Dim tmpStr, i For i=1 to strLength tmpStr = tmpStr & FChar Next If Direction="L" or Direction="" Then ' 왼쪽편 FillChar = Right(tmpStr & strValue, strLength) Else FillChar = Left(strValue & tmpStr, strLength) End If End Function ' -------------------------------------------------------- ' Function Name : ReplaceStr ' Description : NULL CHECK 문자열 치환함수 ' Example : ' output : ' -------------------------------------------------------- Function ReplaceStr(strText, oldString, newString) If NOT IsNull(strText) Then ReplaceStr = Replace(strText, oldString, newString) Else ReplaceStr = "" End If End Function '=========================================================================== '함수명 : SetDBSTR 'INPUT : '기능설명 : DB 입력처리 '=========================================================================== Function SetApostrophe( ByVal strVal ) If Not IsNull(strVal) Then strVal = Replace(strVal, "'", "''") End If SetApostrophe = strVal End Function Function SetTitSTR( ByVal strVal ) If Not IsNull(strVal) Then strVal = Replace(strVal, """", """) strVal = Replace(strVal, "'", "'") End If SetTitSTR = strVal End Function ' -------------------------------------------------------- ' Function Name : ConvertSpecialChar ' Description : 테그문자를 특수문자로를 변환. ' Example : ' output : ' -------------------------------------------------------- Function convertSpecialChar( ByVal StrValue ) If StrValue <> "" Then StrValue = Replace(StrValue, "&", "&") StrValue = Replace(StrValue, "<", "<") StrValue = Replace(StrValue, ">", ">") StrValue = Replace(StrValue, """", """) StrValue = Replace(StrValue, "'", "'") StrValue = Replace(StrValue, "|", "|") StrValue = Replace(StrValue, Chr(13)&Chr(10), "
") convertSpecialChar = StrValue End If End Function ' -------------------------------------------------------- ' Function Name : ReConvertSpecialChar ' Description : 특수문자를 테그문자로변환. ' Example : ' output : ' -------------------------------------------------------- Function reConvertSpecialChar( ByVal strValue ) If strValue <> "" Then strValue = Replace(strValue, "&", "&") strValue = Replace(strValue, "<", "<") strValue = Replace(strValue, ">", ">") strValue = Replace(strValue, """, """") StrValue = Replace(StrValue, "'", "'") strValue = Replace(strValue, "|", "|") strValue = Replace(strValue, "
", Chr(13)&Chr(10)) reConvertSpecialChar = strValue End If End Function '***************************************************************' ' strCutToByte ' 기능설명 : str를 intByte 길이 만큼 자름 '***************************************************************' Function strCutToByteNoMark( ByVal str, ByVal intByte ) Dim i, tmpByte, tmpStr, strCut tmpByte = 0 tmpStr = null If IsNull(str) OR IsEmpty(str) OR str = "" Then strCutToByteNoMark = "" Exit Function End If If returnByte(str) > intByte Then For i = 1 To returnByte(str) strCut = Mid(str, i, 1) tmpByte = tmpByte + returnByte(strCut) tmpStr = tmpStr & strCut If tmpByte >= intByte Then strCutToByteNoMark = tmpStr Exit For End If Next Else strCutToByteNoMark = str End If End Function
'랭귀지 > ASP' 카테고리의 다른 글
ASP 페이지 한글깨짐 (0) | 2018.02.28 |
---|---|
asp에서 json 텍스트를 받아서 파싱 데이터 처리 (0) | 2018.02.21 |
[ASP]마지막 문자열 (0) | 2017.12.26 |
[ASP] 기타함수 (0) | 2017.12.22 |
[ASP] 숫자관련함수 (0) | 2017.12.22 |
Comments