How to split a string by x amount of characters

后端 未结 4 481

I have a program where a user enters a list of numbers in the form of a string. This list of numbers is always a multiple of 8.

So the list can contain 8, 16, 32, 40

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 18:21

    This should split the string into an array of 8-character substrings

    Dim orig = "12344321678900987"
    Dim res = Enumerable.Range(0,orig.Length\8).[Select](Function(i) orig.Substring(i*8,8))
    

提交回复
热议问题