小编Cod*_*ace的帖子

多个if语句检查字符串和缩短的长度

我想知道是否有更好的方法来编写这些多个If语句?我确定有,我只是想不出它是什么.本质上,代码只是缩短了字符串.

                If text = "-----------------" Then
                    text = "-"
                End If
                If text = "----------------" Then
                    text = "-"
                End If
                If text = "---------------" Then
                    text = "-"
                End If
                If text = "--------------" Then
                    text = "-"
                End If
                If text = "-------------" Then
                    text = "-"
                End If
                If text = "------------" Then
                    text = "-"
                End If
                If text = "-----------" Then
                    text = "-"
                End If
                If text = "----------" Then
                    text = "-"
                End …
Run Code Online (Sandbox Code Playgroud)

vb.net performance if-statement

2
推荐指数
1
解决办法
175
查看次数

标签 统计

if-statement ×1

performance ×1

vb.net ×1