::: Zany's Homepage ::: Zany Wiki | »çÀÌÆ® ÅëÇÕ °Ë»ö
 
 
 

[Function] A¹®ÀÚ¿­¿¡¼­ B¹®ÀÚ¿­ÀÌ n¹ø° ³ªÅ¸³ª´Â À§Ä¡°ª

°Ô½ÃÆÇ
Visual Basic
ÀÛ¼ºÀÚ
helix
ÀÛ¼ºÀÏ
2007-06-08 10:51:10
ÀÐÀº¼ö
3072
ÆòÁ¡
   
Ç¥½Ã¿É¼Ç
HTML»ç¿ë | ÀÚµ¿BRűנ| °ø¹é¹®ÀÚÇã¿ë | °¡¿îµ¥Á¤·Ä | °íÁ¤Æø±Û²Ã | ÀÚµ¿URL¸µÅ© | ¸¶¿ì½º¼±ÅÃ
Oracle ÀÇ InStr ÇÔ¼ö´Â ƯÁ¤ ¹®ÀÚ¿­À» ãÀ» ¶§, n ¹ø° ³ªÅ¸³ª´Â ¹®ÀÚ¸¦ ã¾Æ³¾ ¼ö ÀÖ´Ù.
¿¹¸¦ µé¾î abbaccadddaefd ¶ó´Â ¹®ÀÚ¿­ ÀÖÀ» ¶§,
3¹ø° ³ªÅ¸³ª´Â 'a' ÀÇ À§Ä¡°ªÀ» ¾Ë¾Æ³¾ ¼ö°¡ ÀÖ´Ù´Â °ÍÀÌ´Ù.

VB ÀÇ InStr ÇÔ¼ö´Â ±×°Ô ¾ÈµÈ´Ù....
´ë½Å n ¹ø° ¹®ÀÚºÎÅÍ Ã£´Â°Ç µÈ´Ù. Oracle ÀÇ InStr Àº ±×°Ô ¾ÈµÈ´Ù.
... µÑÀÌ ÇϳªÁÖ°í Çϳª»©´Â°Å¾ß? µÑÀÌ Â§°Å¾ß?

¾îÂîµÆ°Ç...
±×·¡¼­ ´ëÃæ ¸¸µé¾îºÃ´Ù. ¤Ñ¤Ñ+







'==============================================================================
' (Zany:2007-05-31) GF_FindStringIdx : sMother ¹®ÀÚ¿­¿¡¼­ sChild °¡ iCnt ¹ø° ³ªÅ¸³ª´Â À§Ä¡¸¦ ¸®ÅÏÇÑ´Ù.
'==============================================================================
Public Function GF_FindStringIdx(sMother As String, sChild As String, iCnt As Integer) As Long

    ' ¸®ÅÏ °ª (¾ç¼ö:Á¤»óÀ§Ä¡, À½¼ö:¿¡·¯)
    '---------------------------------
    ' ¾ç¼ö : sMother ¿¡¼­ iCnt ¹ø° ÀÖ´Â sChild À§Ä¡
    ' À½¼ö : -1   : Parameter °ªÀÌ Á¤È®ÇÏÁö ¾ÊÀ½
    '        -2   : sMother ¿¡¼­ sChild °¡ ÀüÇô ¹ß°ßµÇÁö ¾ÊÀ½
    '        -3   : sMother ¿¡¼­ iCnt ¹ø° ÀÖ´Â sChild °¡ ¾øÀ½
    '---------------------------------

    Dim i As Integer
    Dim iFndIdxPrev As Long
    Dim iFndIdxCurr As Long
    
    If Len(sMother) <= 0 Or Len(sChild) <= 0 Or iCnt <= 0 Then
        GF_FindStringIdx = -1
        Exit Function
    End If
    
    If InStr(sMother, sChild) = 0 Then
        GF_FindStringIdx = -2
        Exit Function
    End If
    
    For i = 1 To iCnt
        
        If i = 1 Then
            iFndIdxCurr = InStr(1, sMother, sChild)
        Else
            iFndIdxCurr = InStr(iFndIdxPrev + Len(sChild), sMother, sChild)
        End If
        
        If iFndIdxCurr = 0 Then
            If i <= iCnt Then
                GF_FindStringIdx = -3
                Exit Function
            End If
        Else
            If i = iCnt Then
                GF_FindStringIdx = iFndIdxCurr
                Exit Function
            ElseIf i < iCnt Then
                iFndIdxPrev = iFndIdxCurr
                iFndIdxCurr = 0
            End If
        End If
        
    Next

End Function

 °Ô½ÃÆÇ ±Û ¸ñ·Ï
No Subject Poster Hits Posted
2605 helix 5012 2011-05-20 09:57:08
helix 3072 2007-06-08 10:51:10
1492 helix 2825 2007-03-29 11:35:46
1135 helix 2638 2006-07-14 13:58:20
ÄÚ¸àÆ®
ÀÛ¼ºÀÚ
                       
 
zany.kr
  Copyright ¨Ï 2002-2010 Zany's Programming Lab. All Rights Not Reserved.
temporary This Page loads on 0.016 Secs