Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce String.split function #2791

Merged
merged 4 commits into from
Sep 25, 2023

Conversation

darkdrag00nv2
Copy link
Contributor

@darkdrag00nv2 darkdrag00nv2 commented Sep 16, 2023

Closes #2752

Description

Adds str.split(_ separator: String): [String] function to Cadence. The function returns a variable sized array of string value after splitting the string with the given separator.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@codecov
Copy link

codecov bot commented Sep 16, 2023

Codecov Report

Patch coverage: 94.73% and project coverage change: +0.11% 🎉

Comparison is base (a88e5eb) 79.73% compared to head (e7a7725) 79.84%.
Report is 26 commits behind head on feature/stable-cadence.

Additional details and impacted files
@@                    Coverage Diff                     @@
##           feature/stable-cadence    #2791      +/-   ##
==========================================================
+ Coverage                   79.73%   79.84%   +0.11%     
==========================================================
  Files                         342      343       +1     
  Lines                       80778    81056     +278     
==========================================================
+ Hits                        64407    64719     +312     
+ Misses                      14063    14027      -36     
- Partials                     2308     2310       +2     
Flag Coverage Δ
unittests 79.84% <94.73%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
runtime/interpreter/value.go 67.15% <93.75%> (+0.06%) ⬆️
runtime/sema/string_type.go 96.42% <100.00%> (+0.20%) ⬆️

... and 17 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

runtime/interpreter/value_string.go Outdated Show resolved Hide resolved
runtime/sema/string_type.go Outdated Show resolved Hide resolved
runtime/sema/string_type.go Outdated Show resolved Hide resolved
runtime/sema/string_type.go Outdated Show resolved Hide resolved
@darkdrag00nv2
Copy link
Contributor Author

Force push due to merge conflicts with String.join function.

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

runtime/interpreter/value.go Outdated Show resolved Hide resolved
runtime/interpreter/value.go Outdated Show resolved Hide resolved
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@SupunS Can you please have a final look and merge once ready? Thanks!

runtime/interpreter/value.go Outdated Show resolved Hide resolved
runtime/tests/interpreter/string_test.go Show resolved Hide resolved
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM!

@SupunS SupunS merged commit fa75807 into onflow:feature/stable-cadence Sep 25, 2023
8 of 11 checks passed
@darkdrag00nv2 darkdrag00nv2 deleted the string_split2 branch September 26, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants