Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42650

VS 2010 Help With Split String Loop

$
0
0
Hello, I'm trying to split a larger text file into equal segments, with the last segment not being the same length as the other segments, just because of how it works out.

This is my code so far :

Code:

        Dim XM% = mystring.Length / 75000 ' Divide by segment size

        Dim XM2% = Math.Round(XM, 1) ' Round to nearest tenth spot

        Dim IX% = 0

        For I% = 0 To XM2

            IO.File.WriteAllText("FilePath", mystring.Substring(IX, IX + 75000)))

            IX% += 75001

        Next

I guess i need to like find out the remainder, by like max - already done and then use that as a final substring set?

sorry for sloppy code, i'm ****ing dead tired and my brain isn't working right atm

Viewing all articles
Browse latest Browse all 42650

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>