Last active
August 29, 2015 14:21
-
-
Save JanVoracek/2f73ed3c258438f1e375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wrap($text, $chunkSize) { | |
return join("\n", str_split($text, $chunkSize)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package codingdojo; | |
import com.google.common.base.Splitter; | |
public class Wrapper { | |
public static String wrap(String text, int chunkSize) { | |
return String.join("\n", Splitter.fixedLength(chunkSize).split(text)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment