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

Create centered-console-text.md #207

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BitMap7487
Copy link

Code snippet for displaying centered text in a console application.

Description

Type of Change

  • ✨ New snippet
  • πŸ›  Improvement to an existing snippet
  • 🐞 Bug fix
  • πŸ“– Documentation update
  • πŸ”§ Other (please describe):

Checklist

  • I have tested my code and verified it works as expected.
  • My code follows the style and contribution guidelines of this project.
  • Comments are added where necessary for clarity.
  • Documentation has been updated (if applicable).
  • [ x There are no new warnings or errors from my changes.

Related Issues

Closes #

Additional Context

Screenshots (Optional)

Click to view screenshots

image

Code snippet for displaying centered text in a console application.
Copy link
Collaborator

@majvax majvax left a comment

Choose a reason for hiding this comment

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

Hey, thanks for your contribution! πŸ™Œ

I really like how you’ve handled both single inputs and collections, making the function versatile and easy to use. However, I think some change are needed.

  • The snippets will become more compact and easier to follow if you merge PrintCentered in CenteredOutput since PrintCentered is only used within CenteredOutput
  • Adding handling in the case the string is > than the width of the console, maybe by normally printing the string ?
  • The snippet is missing the necessary using directives for System, System.Collections, and System.Collections.Generic.

Apart from these little change, your snippet look good. Let me know if you have any questions or need further clarification.

@BitMap7487
Copy link
Author

Hey, thanks for your contribution! πŸ™Œ

I really like how you’ve handled both single inputs and collections, making the function versatile and easy to use. However, I think some change are needed.

  • The snippets will become more compact and easier to follow if you merge PrintCentered in CenteredOutput since PrintCentered is only used within CenteredOutput
  • Adding handling in the case the string is > than the width of the console, maybe by normally printing the string ?
  • The snippet is missing the necessary using directives for System, System.Collections, and System.Collections.Generic.

Apart from these little change, your snippet look good. Let me know if you have any questions or need further clarification.

Thanks for the response. I'll try to edit it as soon as possible. As to the missing necessary using directives. Where do I place them? I have tried to check other C# snippets that should be using using statements and couldnt find any.

@majvax
Copy link
Collaborator

majvax commented Jan 17, 2025

Hello, sorry for my late response. Place them at the top of your snippet, like the C++ one.
We will check if other C# snippets are missing using directives.

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.

2 participants