forked from kc3hack/2024_H
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
splitBraceに渡すテキストが不適切に分割される問題の修正
- Loading branch information
Showing
11 changed files
with
287 additions
and
78 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace KoeBook.Epub.Contracts.Services; | ||
|
||
public interface ISplitBraceService | ||
{ | ||
IEnumerable<string> SplitBrace(string text); | ||
|
||
IEnumerable<string> SplitBrace(IEnumerable<string> texts); | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace KoeBook.Core.Utilities; | ||
|
||
public static class EnumerableEx | ||
{ | ||
public static IEnumerable<(TSource value, bool isFirst, bool isLast)> WithPosition<TSource>(this IEnumerable<TSource> source) | ||
{ | ||
using var enumerator = source.GetEnumerator(); | ||
|
||
var hasNext = enumerator.MoveNext(); | ||
if (!hasNext) | ||
yield break; | ||
var current = enumerator.Current; | ||
hasNext = enumerator.MoveNext(); | ||
yield return (current, true, !hasNext); | ||
|
||
while (hasNext) | ||
{ | ||
current = enumerator.Current; | ||
hasNext = enumerator.MoveNext(); | ||
yield return (current, false, !hasNext); | ||
} | ||
} | ||
} |
Oops, something went wrong.