InStr Function

λ‹€λ₯Έ λ¬Έμžμ—΄ λ‚΄μ—μ„œμ˜ λ¬Έμžμ—΄ μœ„μΉ˜λ₯Ό κ΅¬ν•©λ‹ˆλ‹€.

Instr ν•¨μˆ˜λŠ” μΌμΉ˜ν•˜λŠ” λ¬Έμžμ—΄μ΄ 발견된 μœ„μΉ˜λ₯Ό κ΅¬ν•©λ‹ˆλ‹€. λ¬Έμžμ—΄μ΄ λ°œκ²¬λ˜μ§€ μ•Šμ„ 경우 이 ν•¨μˆ˜λŠ” 0을 κ΅¬ν•©λ‹ˆλ‹€.

ꡬ문:


InStr ([Start As Integer,] Text1 As String, Text2 As String[, Compare])

λ°˜ν™˜ κ°’:

Integer

맀개 λ³€μˆ˜:

Start: A numeric expression that marks the position in a string where the search for the specified substring starts. If you omit this parameter, the search starts at the first character of the string. The minimum allowed value is 1. The maximum allowed value is 2,147,483,648.

Text1: 검색할 λ¬Έμžμ—΄μ΄ ν¬ν•¨λœ λ¬Έμžμ—΄ μ‹μž…λ‹ˆλ‹€.

Text2: 검색할 λ¬Έμžμ—΄ μ‹μž…λ‹ˆλ‹€.

Compare: 비ꡐ μœ ν˜•μ„ μ§€μ •ν•˜λŠ” 선택적 숫자 μ‹μž…λ‹ˆλ‹€. 이 맀개 λ³€μˆ˜λŠ” 0 λ˜λŠ” 1이 될 수 μžˆμŠ΅λ‹ˆλ‹€. κΈ°λ³Έκ°’ 1은 λŒ€/μ†Œλ¬Έμžλ₯Ό κ΅¬λΆ„ν•˜μ§€ μ•ŠλŠ” ν…μŠ€νŠΈ 비ꡐλ₯Ό μ§€μ •ν•©λ‹ˆλ‹€. κ°’ 0은 λŒ€/μ†Œλ¬Έμžλ₯Ό κ΅¬λΆ„ν•˜λŠ” 이진 비ꡐλ₯Ό μ§€μ •ν•©λ‹ˆλ‹€.

To avoid a run-time error, do not set the Compare parameter if the first optional parameter is omitted.

Error codes:

5 잘λͺ»λœ ν”„λ‘œμ‹œμ € ν˜ΈμΆœμž…λ‹ˆλ‹€.

예:


Sub ExamplePosition
Dim sInput As String
Dim iPos As Integer
    sInput = "Office"
    iPos = Instr(sInput,"v")
    Print iPos
End Sub