Skip to content

Commit 3ae66f3

Browse files
author
Mahmoud Ben Hassine
committed
add fold method with default line separator
1 parent 45f5b43 commit 3ae66f3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/io/github/benas/unixstream/Functions.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.github.benas.unixstream;
22

3+
import io.github.benas.unixstream.components.Fold;
4+
35
import java.util.Objects;
46
import java.util.function.Function;
57

@@ -90,6 +92,17 @@ public static Function<String, String> fold(final int width, final String lineSe
9092
};
9193
}
9294

95+
/**
96+
* Fold a String with a given width.
97+
* Lines will be separated with the default System line separator
98+
*
99+
* @param width the fold width
100+
* @return a fold function
101+
*/
102+
public static Function<String, String> fold(final int width) {
103+
return fold(width, Fold.LINE_SEPARATOR);
104+
}
105+
93106
/**
94107
* Transform a String to lower case.
95108
*

0 commit comments

Comments
 (0)