Archive: split

 

Posts Tagged ‘split’


Need to take a string of text and shorten it down but make sure you split on a word break? This little snippet might be exactly what you are looking for. PLAIN TEXT PHP: $text=substr($text, 0, strpos($text, ' ', 50)); effectively you are saying give me the position of the first space after character 50 [...]



 

Linux has a great little utility called split, which can take a file and split it into chunks of whatever size you want, eg 100 line chunks. However, for CSV files etc, each chunk generally needs to have the header row in there. Unfortunately the split command doesn't have an option for that. However with [...]