Skip to content

Extend string module - Part 1 - #159

Merged
gusty merged 6 commits into
fsprojects:masterfrom
cannorin:extend-string-module
Jul 25, 2019
Merged

gusty merged 6 commits into
fsprojects:masterfrom
cannorin:extend-string-module

Conversation

@cannorin

@cannorin cannorin commented Jul 19, 2019 •

Copy link
Copy Markdown
Member

Related: fsharp/fslang-suggestions#102
Closes #158.

This PR adds more string functions to the String module (in Extensions.fs), and use them as the implementation of existing generic functions.

"Part 1" means we have some functions left to be discussed in detail and they are not going to be added in this PR.

See #158 for the discussion.

TODO:

  • Add the following functions ((*) Generic version already exists):

    • findIndex / tryFindindex / findSliceIndex / tryFindSliceIndex
    • padLeft / padRight / padLeftWith / padRightWith
    • trim / trimStart / trimEnd : taking an array.
    • toArray / ofArray / toList / ofList / toSeq / ofSeq (*)
    • item/tryItem (*)
    • rev (*)
    • take / skip / takeWhile / skipWhile / truncate / drop (*)
    • toCodePoints / ofCodePoints
    • getBytes : accept always an encoding.
  • Replace the implementation of following generic functions with the new ones:

    • toArray / ofArray / toList / ofList / toSeq / ofSeq
    • item/tryItem
    • rev skipped because adding it alone would break the existing overload resolution.
    • take / skip / takeWhile / skipWhile / truncate / drop
  • Add some tests for: (skipped trivial functions)

    • findIndex / tryFindindex / findSliceIndex / tryFindSliceIndex
    • padLeft / padRight / padLeftWith / padRightWith
    • trim / trimStart / trimEnd
    • toArray / ofArray / toList / ofList / toSeq / ofSeq
    • item/tryItem
    • rev
    • take / skip / takeWhile / skipWhile / truncate / drop
    • toCodePoints / ofCodePoints
    • getBytes

@cannorin

Copy link
Copy Markdown
Member Author

hmm the CI script on Travis seems to be broken

Co-authored-by: Elliott Brown <EBrown8534@users.noreply.github.com>
@cannorin
cannorin force-pushed the extend-string-module branch from 96da951 to 8a74fe2 Compare July 23, 2019 05:51
@cannorin

Copy link
Copy Markdown
Member Author

This push -f is for correctly co-authoring @EBrown8534.

Comment thread src/FSharpPlus/Extensions.fs Resolved
@cannorin

Copy link
Copy Markdown
Member Author

As FAKE build script is not working on my machine, I've run NUnit manually on the test assembly and confirmed that the test about toCodePoints / ofCodePoints I added passes.

@gusty gusty changed the title [WIP] Extend string module - Part 1 Extend string module - Part 1 Jul 25, 2019
@gusty
gusty requested review from gusty and wallymathieu July 25, 2019 08:30
Comment thread src/FSharpPlus/Extensions.fs Resolved
@gusty
gusty merged commit 3d1d1e0 into fsprojects:master Jul 25, 2019
gusty pushed a commit that referenced this pull request Jul 25, 2019
Co-authored-by: Elliott Brown <EBrown8534@users.noreply.github.com>

This fixes #158
wallymathieu pushed a commit that referenced this pull request Jul 25, 2019
This fixes #158

Co-authored-by: Elliott Brown <EBrown8534@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more string functions

2 participants