Find position of first occurrence of a substring in a string

前端 未结 3 787
无人及你
无人及你 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].

提交回复
热议问题