Access VBA 查找字符串的最后一次出现?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17460938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Access VBA find the last occurrent of a string?
提问by Nexus
Access VBA has Instr to return the position of the first occurrence of a string in another string.
Access VBA 有 Instr 来返回一个字符串在另一个字符串中第一次出现的位置。
Instr ( [start], string_being_searched, string2, [compare] )
Is there any method to return the position of the last occurrence of a string in another string?
有没有什么方法可以返回一个字符串在另一个字符串中最后一次出现的位置?
回答by barrowc
回答by Calum
Check this link, example code from MS
检查此链接,来自 MS 的示例代码
https://msdn.microsoft.com/en-us/library/t2ekk41a(v=vs.90).aspx
https://msdn.microsoft.com/en-us/library/t2ekk41a(v=vs.90).aspx
Dim TestString As String = "the quick brown fox jumps over the lazy dog"
Dim TestNumber As Integer
' Returns 32.
TestNumber = InStrRev(TestString, "the")
' Returns 1.
TestNumber = InStrRev(TestString, "the", 16)