How to split a string into a fixed length string array?

前端 未结 8 1864
别跟我提以往
别跟我提以往 2020-12-21 02:10

I have a long string like this

dim LongString as String = \"123abc456def789ghi\"

And I want to split it into a string array. Each element

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 02:30

    I'm splitting the string by 35.

    var tempstore ="12345678901234567890123456789012345";
    
    for (int k = 0; k < tempstore.Length; k += 35) {
        PMSIMTRequest.Append(tempstore.Substring(k,
          tempstore.Length - k > 35 ? 35 : tempstore.Length - k));
        PMSIMTRequest.Append(System.Environment.NewLine);
    }
    
    messagebox.Show(PMSIMTRequest.tostring());
    

提交回复
热议问题