BLOG main image

같은생각
From... Las

Home | Local log | Tag | Google RSS | Google analytics | Trace watch | Guestbook  
     - 잘 지내나요?
    List  

'함수모음'에 해당되는 글 1건

  1. 2009/05/30 여러가지 ASP 관련 함수 모음

여러가지 ASP 관련 함수 모음

1차출처 :  http://www.taeyo.pe.kr/threadboard/Content.asp?table=Board_Knowhow&seqs=735&page=1&IsSearch
2차출처 : http://www.mungchung.com/xe/protip/3223/page/5

'===================================================================
'==    설명 : 문장을 해당 자릿수만큼 <br>이 들어간 문장으로 변환
'==    이름 : MakeBr(Str,Pos)
'==    변수 : Str(String),Pos(Int)
'==    반환 : String
'===================================================================
Function MakeBr(Str,Pos)

   Dim StrLen, TmpStr, i, Midcnt, Start, Surplus
   
   StrLen = len(Str)
   
   If (StrLen Mod Pos) = 0 then
       MidCnt = Fix(StrLen/Pos)
   Else
       MidCnt = Fix(StrLen/Pos) + 1
   End If
   
   for i = 1 to MidCnt
       if i = 1 then
           TmpStr = TmpStr&Mid(Str,i,pos)&"<br>"
       Else
           TmpStr = TmpStr&Mid(Str,((i-1)*Pos)+1,pos)&"<br>"
       End If
   next
   
   MakeBr = TmpStr
End Function


' ##################################################################################
' 검색에서 selected
' ##################################################################################
Function getSelected(search,t)
   if search = t then
       getSelected ="selected"
   end if
End function  

' ##################################################################################
' checked
' ##################################################################################
Function getChecked(tag,y)
   If tag = y then
       getChecked = "checked"
   End if
End function

' ##################################################################################
' 자동링크
' ##################################################################################

 FUNCTION autolink(CONTENT)
 
   DIm Re
   Set re = New RegExp
   
   ' First Pass for http
   re.Pattern = "(\w+):\/\/([^/:]+)(:\d*\b)?([^# \n<]*).*\n"
   re.Pattern = "http://( [0-9a-zA-Z./@:~?&=_-]+)"
   re.Global = True
   re.IgnoreCase = True
   
   ' ASP seems to be not supporting .MultiLine method.
   're.MultiLine = True
   
   CONTENT = re.Replace(CONTENT,"<a target=_blank href='http://$1'>http://$1</a> ")
   
   ' Second Pass for mail
   re.Pattern = "([_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*)@([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)"
   autolink = re.Replace(CONTENT,"<a href='mailto:$1@$3'>$1@$3</a>")
 
 END FUNCTION  

' ##################################################################################
' 문자열 체크 (리턴값:boolean)
' ##################################################################################
Function chkStrFlag(Val, chkStr)
   Dim flag, MyPos
   
   If Val = "" then
       flag = false
   Else
       Mypos =Instr(Val,chkStr)
       If MyPos = 0 then
           flag=false
       Else
           flag=true
       End If
   End If
   
   chkStrFlag = flag
End Function


'##################################################################################
'     문자열 체크 (공백이나 NULL값 체크)
'    Val    : 체크 값, r_Val (대체값)
'##################################################################################
Function replaceVal(val, r_Val)
   Dim flag, MyPos
   
   If (val = "") or IsNull(Val) then
       replaceVal = r_Val
   Else
       replaceVal = val
   End If
End Function



'##################################################################################
'     숫자값 자릿수만큼 문자로 변경 (공백이나 NULL값 체크)
'    Val    : 체크 값, chkLen 자릿수 , r_Val(대체값)
'##################################################################################
Function chkLenReplaceVal(val,chkLen, r_Val)
   Dim chkCnt, MyPos
       chkCnt = len(Cstr(val))

   If chkCnt < chkLen then
       chkLenReplaceVal =  val
       
       for i = 1 to (chkLen-chkCnt)
           chkLenReplaceVal = r_Val&chkLenReplaceVal
       next
   Else
       chkLenReplaceVal = val
   End If

End Function



'##################################################################################
'     널값,""값 확인
'    Val    : 체크 값
'    retun 값 : true, false
'##################################################################################
Function chkBlank(val)
   If (val = "") or IsNull(Val) then
       chkBlank = true
   Else
       chkBlank = false
   End If
End Function


'##################################################################################
'     비교값 리턴
'    Val    : 체크 값
'    retun 값 : true, false 또는 대치 문장
'##################################################################################
Function replaceStr(str, chkStr, replaceStr1, replaceStr2)
   If str = chkStr then
       replaceStr = replaceStr1
   Else
       replaceStr = replaceStr2
   End If
End Function


'##################################################################################
'     NULL값 만들기
'    Val    : 값
'    retun 값 : NULL, 문장
'##################################################################################

Function makeNull(str)
   If str="" or IsNull(str) then
       makeNull = "NULL"
   Else
       makeNull = str
   End IF
End Function

'##################################################################################
'     HTML 태그 지우기 (정규식표현)
' 인자 : strHTML:문장, patrn : 패턴 문장
'    retun 값 : String
'##################################################################################

Function stripHTML(strHTML, patrn)
 Dim objRegExp, strOutput
 Set objRegExp = New Regexp

 objRegExp.IgnoreCase = True
 objRegExp.Global = True
 objRegExp.Pattern = patrn

 'objRegExp.Pattern = "<.+?>"   '''' 태그완전히없앰


 strOutput = objRegExp.Replace(strHTML, "")

 stripHTML = strOutput

 Set objRegExp = Nothing
End Function

'##################################################################################
' 문자 잘라내기
'##################################################################################
Function CutString(Str,Length,Patten)
 If Len(Str) > Length Then
   CutString = Left(Str,Length-3) & patten
 Else
   CutString = Str
 End If
End Function



별건 아니구요..그냥 가끔 디버깅시에 쓰는 함수에요
####################################################
Sub DbPrintErrMsg(obj)

Dim errLoop
   For Each errLoop In obj.Errors
       response.write "#############<br>"
       response.write "Error Number: " & errLoop.Number & "<br>"
       response.write "Description: " & errLoop.Description &  "<br>"
       response.write "Source: " & errLoop.Source &  "<br>"
       response.write "SQL State: " & errLoop.SQLState &  "<br>"
       response.write "Native Error: " & errLoop.NativeError & "<br>"
       response.write "#############<br>"
   Next
End Sub

########폼값 확인할때###################
Sub Prt_RequestForm(obj)

Dim item
   For Each item In obj
       response.write "#############<br>"
       response.write item&" : " &obj(item)& "<br>"
       response.write "#############<br>"
   Next
End Sub
ex) Prt_RequestForm(Request.Form), Prt_RequestForm(Request.QueryString),
Prt_RequestForm(UploadForm)
Category : My page/Sql & Asp   Tag :  
2009/05/30 13:52   By Las 
Trackback : Comment

prev page next page
1 

Recent Entry

Recent Comment

Recent Trackback

Counter

Total : 254754 Today : 0 Yesterday : 52

Tag cloud

..., ......ing, ActiveX 삭제, ADO, ADO 성능 높이기, agp, Aids, Another World, apple cinema, asp, Aya Ueto, A형, Baldurs Gate, bard, BEO Player, Book, Bryan adams, CGV, Chante Moore, clie, compact, Compilation, Convert, DAO, dao에서 ADO로, DarkNamer, datetime, DB restore, DB 복구, db 테이블 정의서, dell 2007WFP, DreamFall: The Longest Journey, dvd, DVD 타이틀, ecotonoha, eve-online, event.keyCode 번호표, Facebook, favicon, favis, Faye Wong, FLASH, Fon, Fon Lafontenna, fon maps, FON 지향성 안테나, footnote, Fun, Game, Gamecube, game_ost, GETDATE, Google, Google analytics, Graphic card, hanami, HDTV 수신카드, heaven, HijackThis, I-RAM, i4R, IceWind Dale, IE ActiveX, IE Plug-in, IETOY, include, irc, ishihara satomi, isNull, Java, JavaScript, jazz, join update, j_drama, j_music, kav, kb917422, Kenny G, keyboard_Fun, k님, Launcher, LightBox2, Linked Server, linux, Lottery Music, M.Friends, Maki Horikita, Matsu Takako, mdb, MDB생성, MDB압축, Microsoft iPod, mp3, mp3 Media Player, MSN Live, MSN Messenger, Mssql, Myminicity, NEC, NeverwinterNights, o-game, ogame, one more time, Open Your Eyes, opencapture, openTTD, PageDefrag, palm, pc_game, pc_game_tip, PC업그레이드, Pda, Petit Launcher, picture, pinball, Pink Floyd, program, ps3, punkbuster, RAID, RDO, Remake, retrievr, Review, Search, settler, settler2, skt 포인트소멸, songlist, sony usm2gj, spread, SqL, Starry Night, sudoku, Symphonic, THE ERASER, The Father, The isley brothers, thecheat, theinquirer, Think, THOM YORKE, Time, tip, Tistory, tracewatch, Twitter, ubuntu, Uchiyama Rina, Ueto Aya, UltraMon, unplugged, us and them, util, ux50, vangard, vb, wallpaper, Web관련, Wii, WOW, xirc, xp install, yui, Yumiko Shaku, z22, Zoo 愛をください, Zune, クロサギ, ソニン, 上戸彩, 優香, 我願意, 王菲, 王靖雯, 白い影, 가상주민등록번호, 강릉, 건슈팅, 검색로봇, 고냥군, 괴물, 구입기, 그해 여름, 그해여름 OST, 기억상실, 기억속의 인물, 김연아, 꿈 속에 살아가다, 난수 발생, 날개셋, 날씨, 내캐릭, 내컴퓨터, 놀자, 다랭이, 다스베이더, 다케우치 유코, 당신은 사랑받기 위해 태어난 사람, 더워, 데이터가져오기, 독백, 동생, 듀얼모니터, 레지스트리 청소, 로또, 로코모션, 마마님, 머리속, 메타정보, 미완료작업물, 밀란쿤데라, 바탕화면 아이콘을 줄이자, 박x무당님, 범프키, 보안카드, 북다트, 블랙잭, 뿌리를찾아서, 사제, 삼돌이, 삼벌식, 삽질의 현장, 생각, 생활의 지혜, 설명, 성격, 세계 AIDS의날, 소닌, 스타더스트, 스티브잡스, 스팸댓글, 시스템, 신동우, 신승훈, 실시간알리미, 싸이월드 플러그인, 안나님, 언락, 업데이트, 연애편차치, 영화를 보다, 오소영, 옥션광고, 와라님, 외장하드, 우에토 아야, 웨군, 웹표준, 유용한 소스, 유카, 윤창군, 음악저작권법, 이동성, 이벤트당첨, 이사, 이승환 9집, 이자람, 인희, 일본연예인, 자바스크립트 코드 작성법, 자식창에서 부모창 함수 사용, 잘지내나요?, 잡담, 저장프로시저, 정규식, 젠장!!!, 족보, 즐거운인생, 지름, 천안전씨, 추억과 이야기들, 카툰, 칼리브레이션, 캡쳐, 컴터 다운, 컴터업, 케로로중사 중에서, 키트님, 태양의노래 OST, 테더스킨, 테터툴즈, 투명한얼음, 트랙백놀이, 트릭, 특성, 파일이름바꾸기, 파코즈, 편한사람, 플러그인, 하고싶어, 한국 지도 서비스, 한글입력기, 함수모음, 향수, 혈액형, 혼자놀기, 후회,