Advertisement
2002ASP String Manipulation #276

RevInStr

Visual Basic 6 has a new function called InStrRev, which searches a string from right to left. I found it very usefeul, so much so that a project of mine relies completely on it. When I tried to work on the project at another location on VB5 I found that the function did not exist. So, I wrote it. I left out the compare method, you can add it if you want

AI

AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

소스 코드
original-source
Public Function RevInStr(String1 As String, String2 As String) As Integer
  Dim pos As Integer
  Dim pos2 As Integer
  
  Let pos2 = Len(String1)
  Do
    Let pos = (InStr(pos2, String1, String2))
    Let pos2 = pos2 - 1
  Loop Until pos > 0 Or pos2 = 0
  Let RevInStr = pos
End Function
원본 댓글 (3)
Wayback Machine에서 복구됨