Skip to content

Commit

Permalink
Merge pull request #25 from ZhanZiyuan/feature/split-long-str
Browse files Browse the repository at this point in the history
Added the function `split_long_str()`.
  • Loading branch information
ZhanZiyuan authored Jul 17, 2024
2 parents e1692a2 + 0d11cc4 commit d7c7354
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions string_processors/backslash_to_slash.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ def backslash_to_slash_str(path: str) -> str:
return path.replace("\\", "/")


def split_long_str(long_str: str,
length_of_fragment: int) -> str:
"""
Split a long string into fragments.
"""
return "\n".join(
[
long_str[index: index+length_of_fragment]
for index in range(0, len(long_str), length_of_fragment)
]
)


if __name__ == "__main__":

windows_path_c_01 = (
Expand Down

0 comments on commit d7c7354

Please sign in to comment.