我正在操纵琴弦
我希望输出字符串仅在2个特定字符(=
和o
)
我可以通过重复两次来做到这一点:
For f = 1 To Len(line5)
If Mid(line5, f, 1) = "=" Then
line5 = Mid(line5, f, Len(line5) - f + 1)
line5 = line5_out
End If
=
一次,o
有更快的方法吗?
答案 0 :(得分:0)
有多种方法可以做到,最好的"方式取决于你究竟需要什么。 除了这些评论之外,还有两种方法可以做到:
'Delete everything behind o and infront of =
YourString = YourString.Remove(YourString.LastIndexOf("o") + 1, YourString.Length - YourString.LastIndexOf("o") - 1).Remove(0, YourString.IndexOf("="))
'Get part of string between = and o
YourString = YourString.Substring(IndexOf("="), YourString.LastIndexOf("o") + 1 - YourString.IndexOf("="))