Find position of first occurrence of a substring in a string

前端 未结 3 679
无人及你
无人及你 2021-01-18 22:35

I wan\'t a method with which to find a string within another string. It should return the position of the first occurrence of the substring. (In VB 2008 !)

相关标签:
3条回答
  • 2021-01-18 22:39

    position = instr([stringField] & " ", " ")

    Looking for the first blank in what might be an empty string named [stringField]. The ' & " "' avoids an error situation where there are no blanks in [stringField].

    0 讨论(0)
  • 2021-01-18 22:50

    I think you are looking for InStr function, see: InStr at msdn

    0 讨论(0)
  • 2021-01-18 23:05

    String.IndexOf

    0 讨论(0)
提交回复
热议问题