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
|
|
|