Core Function ChunkSplit
From Sputnik Wiki
(Difference between revisions)
UberFoX (Talk | contribs)
(Created page with "<pre> ChunkSplit( <body>, <chunklen>, <end> ) </pre> === Description === Split a string into smaller chunks. === Parameters === ==== body ==== The string to be chunked. ==...")
Newer edit →
(Created page with "<pre> ChunkSplit( <body>, <chunklen>, <end> ) </pre> === Description === Split a string into smaller chunks. === Parameters === ==== body ==== The string to be chunked. ==...")
Newer edit →
Revision as of 13:44, 11 September 2013
ChunkSplit( <body>, <chunklen>, <end> )
Contents |
Description
Split a string into smaller chunks.
Parameters
body
The string to be chunked.
chunklen
The chunk length.
end
The line ending sequence.
Return Value
Success: Returns the chunked string.
Failure: Returns null.
Remarks
None
Example
$string = '1234'; say ChunkSplit($string, 2, ':'); // Prints 12:34: $string = '123'; say ChunkSplit($string, 2, ':'); // Prints 12:3
The best way to solve the problem (if its a problem for you) with the last string added by ChunkSplit() is:
$string = '1234'; say substr(chunk_split($string, 2, ':'), 0, -1); // will return 12:34 instead of 12:34: