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

A few text joining functions for ReportingUtilities #5135

Merged
merged 2 commits into from
Oct 27, 2024

Conversation

WeaverThree
Copy link
Collaborator

Figured I'd break these out of my Refit rework.

For example, surroundIf("(", maybeText, ")") will return "(<maybeText>)" or "" depending on the status of maybeText

separateIf(text1, ", ", text2) will return one of "<text1>, <text2>", "<text1>", "<text2>", or "" based on the status of the first and last parameters.

They're pretty simple, but can declutter a lot of the simpler cases of things where using a StringBuilder or StringJoiner seems like overkill.

The names are inspired by WinAmp title formatting marcos ^^;.

@codecov-commenter
Copy link

codecov-commenter commented Oct 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.53%. Comparing base (0702c03) to head (fb6c52a).
Report is 28 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5135      +/-   ##
============================================
- Coverage     10.53%   10.53%   -0.01%     
  Complexity     6041     6041              
============================================
  Files           956      956              
  Lines        134213   134253      +40     
  Branches      19489    19501      +12     
============================================
+ Hits          14140    14142       +2     
- Misses       118722   118760      +38     
  Partials       1351     1351              

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

@WeaverThree
Copy link
Collaborator Author

If you're reading this on the Discord and it looks confusing, Discord ate half of my exapmle strings >.>

@HammerGS HammerGS merged commit f0099f1 into MegaMek:master Oct 27, 2024
4 checks passed
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.

3 participants