以下代码有效。
Dim aaa As String = "aa@aa"
If aaa.Contains("@") Then
MsgBox("Error1")
End If
以下代码无效。
Dim bbb As String = "bb@bbcc@cc"
If bbb.Contains("*@*@*") Then
MsgBox("Error2")
End If
那么,以下行有什么问题?
If bbb.Contains("*@*@*") Then
答案 0 :(得分:2)
这是因为字符串library(dplyr)
df1 %>%
group_by(Name) %>%
filter(row_number() <=3) %>%
summarise(Score = max(Score))
# A tibble: 3 × 2
# Name Score
# <chr> <int>
#1 A 7
#2 B 4
#3 C 4
不包含字符序列bbb
。
*@*@*
不支持通配符。
你可以改用它。
String.Contains
答案 1 :(得分:1)
您不能使用通配符。
包含不支持 var connectorPaintStyle = {
strokeWidth: 2,
stroke: "#61B7CF",
joinstyle: "round",
outlineStroke: "white",
outlineWidth: 2
};
var conn = jsptoolkit.jspinstance.connect({
source: line.sdata.sourceId,
target: line.sdata.targetId,
anchors: line.sdata.anchors,
paintStyle: connectorPaintStyle,
connector: ["Flowchart", { stub: [2, 2], gap: 1, cornerRadius: 5, alwaysRespectStubs: true }],
});
通配符。也许试试这个?
*
答案 2 :(得分:0)
您可以使用.count()
来确定@
的出现次数并相应地显示消息。
Dim bbb As String = "bb@bbcc@cc"
Dim cnt As Integer
cnt = bbb.Count(Function(x) x = "@") 'Number of @ in the string
If cnt = 1 Then
MsgBox("Error1")
ElseIf cnt = 2 Then
MsgBox("Error2")
End If
注意:我假设OP正在寻找字符串中出现的字符,而不是要遵循的特定模式