How can I iterate through the alphabet in Visual B

2020-07-03 07:24发布

I need to generate a loop that would iterate through each capital letter of the alphabet using Visual Basic (2008). What's the cleanest way to do this?

标签: vb.net
7条回答
劫难
2楼-- · 2020-07-03 08:28

I figured it out. Anyone have a better solution?

To loop through the alphabet:

For i As Int16 = Convert.ToInt16("A"c) To Convert.ToInt16("Z"c)
        Dim letter As Char = Convert.ToChar(i)
        'Do my loop work...
Next

Letter will first equal "A", then "B", etc.

Anyone have a better solution?

查看更多
登录 后发表回答