gpt4 book ai didi

vba - 如何设置大小写以省略任何小于 X 个字符的单词

转载 作者:行者123 更新时间:2023-12-04 21:22:32 25 4
gpt4 key购买 nike

我正在使用以下循环。我有一个省略或 blacklists certain words in VBA 的案例.但是,我想省略任何少于 3 个字符的单词。

For i = 0 To UBound(words, 1)
Select Case words(i)
Case = "and","or","big","small","whatever else you want to add"
Case Else
For Each phrase In phrases
If InStr(1, phrase.Value, words(i)) Then
matches = matches & phrase & "/"
End If
Next phrase
End Select
Next i

有谁知道该怎么做?我在想 Case => "[something for 3 characters]"与附加代码一起插入。感谢您的积极投入和支持。

最佳答案

测试单词的长度:

For i = 0 To UBound(words, 1)
If Len(words(i)) > 2 Then
Select Case words(i)
Case = "and", "big", "small", "whatever else you want to add"
Case Else
For Each phrase In phrases
If InStr(1, phrase.Value, words(i)) Then
matches = matches & phrase & "/"
End If
Next phrase
End Select
End If
Next i

关于vba - 如何设置大小写以省略任何小于 X 个字符的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41272269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com