Skip to content

Commit a13c34a

Browse files
committed
feat(Slice): 新增 mapStringTo() 静态方法
1 parent 44cdc9d commit a13c34a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/me/codeplayer/util/Slice.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ static <R> Slice<R> mapLongTo(Function<? super Long, R> mapper) {
7373
return (String str, int start, int end) -> mapper.apply(asLong(str, start, end));
7474
}
7575

76+
static <R> Slice<R> mapStringTo(Function<? super String, R> mapper) {
77+
return (String str, int start, int end) -> mapper.apply(parseString(str, start, end));
78+
}
79+
7680
default <R> Slice<R> andThen(Function<? super E, R> after) {
7781
return (String str, int start, int end) -> after.apply(sliceAs(str, start, end));
7882
}

0 commit comments

Comments
 (0)