vendredi 28 juillet 2017

Multiple if statements checking length of string and shortening

I'm wondering if there's a better way of writing these multiple If statements? I'm sure there is, I just can't figure out what it'd be. In essence the code is just shortening the string.

                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 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 If

Any help is much appreciated.

Aucun commentaire:

Enregistrer un commentaire