InStr Function

āĻāĻ•āϟāĻŋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āĻ…āĻ¨ā§āϝ āĻāĻ•āϟāĻŋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāϰ āĻ…āĻŦāĻ¸ā§āĻĨāĻžāύ āĻĒā§āϰāĻĻāĻžāύ āĻ•āϰ⧇āĨ¤

Instr āĻĢāĻžāĻ‚āĻļāύāϟāĻŋ āϝ⧇āĻ–āĻžāύ⧇ āĻŽāĻŋāϞ āĻĒāĻžāĻ“ā§ŸāĻž āϝāĻžā§Ÿ āϏ⧇āϟāĻŋāϰ āĻ…āĻŦāĻ¸ā§āĻĨāĻžāύ āĻĒā§āϰāĻĻāĻžāύ āĻ•āϰ⧇ āĻĨāĻžāϕ⧇āĨ¤ āϝāĻĻāĻŋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚āϟāĻŋ āĻĒāĻžāĻ“ā§ŸāĻž āύāĻž āϝāĻžā§Ÿ, āĻĢāĻžāĻ‚āĻļāύāϟāĻŋ 0 āĻĒā§āϰāĻĻāĻžāύ āĻ•āϰ⧇ āĻĨāĻžāϕ⧇āĨ¤

āϏāĻŋāύāĻŸā§āϝāĻžāĻ•ā§āϏ:


nStr ([Start As Long,] 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: āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ āϝāĻž āφāĻĒāύāĻŋ āĻ…āύ⧁āϏāĻ¨ā§āϧāĻžāύ āĻ•āϰāϤ⧇ āϚāĻžāύāĨ¤

āϤ⧁āϞāύāĻž: āϐāĻšā§āĻ›āĻŋāĻ• āϏāĻ‚āĻ–ā§āϝāĻžāϏ⧂āϚāĻ• āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ āϝāĻž āϤ⧁āϞāύāĻžāϰ āϧāϰāύ āύāĻŋāĻ°ā§āϧāĻžāϰāĻŖ āĻ•āϰ⧇ āĻĨāĻžāϕ⧇āĨ¤ āĻāχ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ⧇āϰ āĻŽāĻžāύ 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 Invalid procedure call

āωāĻĻāĻžāĻšāϰāĻŖ:


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

Please support us!