user52 Posted October 29, 2009 Posted October 29, 2009 #include <String.au3> $str = _ 'this.' & _ 'is.a.' & _ 'strin' & _ 'g' ConsoleWrite(chunk_split($str, 5) & @CRLF) ConsoleWrite('============================================================================' & @CRLF) $str = _ 'this.is.the.start.of' & _ '.some.string.that.sh' & _ 'ould.be.split.into.c' & _ 'hunks' & _ '' ConsoleWrite(chunk_split($str, 20) & @CRLF) Func chunk_split($body, $chunklen = 76, $end = @CRLF) $len = StringLen($body) $chunks = Ceiling($len / $chunklen) $end_len = StringLen($end) $newbody = $body $ends = 0 For $i = $chunklen To $len Step $chunklen $pos = ($chunklen * $ends) + ($end_len * $ends) + $chunklen $newbody = _StringInsert($newbody, $end, $pos) $ends += 1 Next Return $newbody EndFunc ;==>chunk_split #cs this. is.a. strin g ============================================================================ this.is.the.start.of .some.string.that.sh ould.be.split.into.c hunks #ce
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now