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
- IPO
- 공모주 청약 일정
- html
- Stock ipo
- 맥
- linux
- css
- codeigniter
- 자바
- JavaScript
- SQL
- Eclipse
- 오라클
- MYSQL
- 주식 청약 일정
- Stock
- 자바스크립트
- 제이쿼리
- 주식
- java
- jquery
- 공모주
- 6월 공모주 청약 일정
- 공모주 청약
- php
- 코드이그나이터
- 주식 청약
- 리눅스
- Oracle
- 7월 공모주 청약 일정
Archives
- Today
- Total
개발자의 끄적끄적
[asp] asp 유용한 함수 모음 본문
728x90
반응형
[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 : 문자열내 자동링크 걸기
'===========================================================================
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 : 해당파일이 이미지 파일인지 체크
'===========================================================================
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 값 설정
'===========================================================================
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 : 임시비밀번호
'===========================================================================
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 문자열 치환함수
'===========================================================================
Function ReplaceStr(strText, oldString, newString)
If NOT IsNull(strText) Then
ReplaceStr = Replace(strText, oldString, newString)
Else
ReplaceStr = ""
End If
End Function
'===========================================================================
'함수명 : SetDBSTR
'기능설명 : 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 : 테그문자를 특수문자로를 변환.
'===========================================================================
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 : 특수문자를 테그문자로변환.
'===========================================================================
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
출처: https://shstarkr.tistory.com/31 [아마그래머]
반응형
'개발 > asp' 카테고리의 다른 글
[asp] asp 파일명 / 확장자 가져오기 (0) | 2019.10.16 |
---|---|
[asp] asp 파일 삭제 (0) | 2019.10.16 |
[asp] asp 정규식을 이용한 html 태그 제거 함수 (0) | 2019.10.02 |
[asp] asp 날짜 관련 함수 모음 (0) | 2019.10.01 |
ASP Form Input 배열로 받고 처리하기 (0) | 2019.09.17 |
Comments