Skip to content

Commit 1eb8931

Browse files
committed
Add project files
1 parent d809c0c commit 1eb8931

File tree

52 files changed

+595
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+595
-1
lines changed

README.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,85 @@
1-
# CSharp-Text-Truncator
1+
# CSharp-Text-Truncator
2+
3+
## Overview
4+
5+
Welcome to the **CSharp Text Truncator** project! This is a straightforward **C# console application** designed to truncate long text strings gracefully, ensuring they do not exceed a specified maximum length.
6+
7+
The goal of this project is to demonstrate a simple way to shorten text by cutting it off at word boundaries and appending an ellipsis (`...`) when truncated. It's perfect for beginners learning string manipulation in C# or anyone needing a quick utility to truncate text snippets.
8+
9+
---
10+
11+
## Project Structure
12+
13+
- **CSharp-Text-Truncator**: A standalone console app that:
14+
- Accepts a long text string.
15+
- Truncates the text without breaking words when exceeding a max length.
16+
- Outputs both the original and truncated text to the console.
17+
- Uses a customizable maximum length setting.
18+
19+
---
20+
21+
## Features
22+
23+
- Truncates text based on a configurable maximum character limit (default: 20).
24+
- Ensures words are not cut in the middle—truncation happens cleanly at word boundaries.
25+
- Adds an ellipsis (`...`) to indicate that the text has been shortened.
26+
- Minimal, easy-to-understand C# implementation.
27+
- Easily adaptable for different text sources or truncation rules.
28+
29+
---
30+
31+
## How It Works
32+
33+
The app splits the input text into words and iteratively adds them until the total length (including spaces) would exceed the maximum allowed. It then stops and appends `...` to indicate truncation.
34+
35+
---
36+
37+
## Output Example
38+
39+
Original: This is going to be a really really really really really long text!
40+
Truncated: This is going to be a ...
41+
42+
43+
Each run produces the truncated text based on the defined max length.
44+
45+
---
46+
47+
## How to Run
48+
49+
1. Open the solution in **Visual Studio** or your preferred C# IDE.
50+
2. Set the project as the startup project.
51+
3. Press `F5` or run the project.
52+
4. The console will display both the original and truncated text.
53+
54+
---
55+
56+
## Screenshots
57+
58+
### Console Output
59+
60+
![Console Output](https://github.com/ElliotOne/CSharp-Text-Truncator/blob/master/screenshots/first.png)
61+
62+
---
63+
64+
## Technologies Used
65+
66+
- [.NET 6](https://dotnet.microsoft.com/)
67+
- [C#](https://learn.microsoft.com/en-us/dotnet/csharp/)
68+
- [Visual Studio](https://visualstudio.microsoft.com/)
69+
70+
---
71+
72+
## License
73+
74+
This project is licensed under the MIT License. Feel free to use, modify, and distribute it.
75+
76+
---
77+
78+
## Contributions
79+
80+
Contributions are very welcome! You can fork the repo, submit issues, or open pull requests to add features such as:
81+
82+
- Custom ellipsis symbols or suffixes.
83+
- Support for truncating by word count instead of characters.
84+
- Command-line parameters for input text and max length.
85+
- GUI or web interface.

screenshots/first.png

52.4 KB
Loading
80.2 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
658 Bytes
Binary file not shown.
38 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"Version": 1,
3+
"WorkspaceRootPath": "D:\\1.Projects\\1.Portfolio\\2.OpenSource\\2.Applications_PUSHToGit\\8.CSharp Text Summarizing\\CSharpTextSummarizing\\",
4+
"Documents": [],
5+
"DocumentGroupContainers": [
6+
{
7+
"Orientation": 1,
8+
"VerticalTabListWidth": 256,
9+
"DocumentGroups": [
10+
{
11+
"DockedHeight": 200,
12+
"SelectedChildIndex": -1,
13+
"Children": [
14+
{
15+
"$type": "Bookmark",
16+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
17+
}
18+
]
19+
}
20+
]
21+
}
22+
]
23+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"Version": 1,
3+
"WorkspaceRootPath": "D:\\1.Projects\\1.Portfolio\\2.OpenSource\\2.Applications_PUSHToGit\\8.CSharp-Text-Summarizer\\CSharpTextSummarizing\\",
4+
"Documents": [
5+
{
6+
"AbsoluteMoniker": "D:0:0:{197EB142-89B6-456D-8B7C-F825E4483141}|CSharpTextSummarizing\\CSharpTextSummarizing.csproj|d:\\1.projects\\1.portfolio\\2.opensource\\2.applications_pushtogit\\8.csharp-text-summarizer\\csharptextsummarizing\\csharptextsummarizing\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
7+
"RelativeMoniker": "D:0:0:{197EB142-89B6-456D-8B7C-F825E4483141}|CSharpTextSummarizing\\CSharpTextSummarizing.csproj|solutionrelative:csharptextsummarizing\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
8+
}
9+
],
10+
"DocumentGroupContainers": [
11+
{
12+
"Orientation": 1,
13+
"VerticalTabListWidth": 256,
14+
"DocumentGroups": [
15+
{
16+
"DockedHeight": 200,
17+
"SelectedChildIndex": 1,
18+
"Children": [
19+
{
20+
"$type": "Bookmark",
21+
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
22+
},
23+
{
24+
"$type": "Document",
25+
"DocumentIndex": 0,
26+
"Title": "Program.cs",
27+
"DocumentMoniker": "D:\\1.Projects\\1.Portfolio\\2.OpenSource\\2.Applications_PUSHToGit\\8.CSharp-Text-Summarizer\\CSharpTextSummarizing\\CSharpTextSummarizing\\Program.cs",
28+
"RelativeDocumentMoniker": "CSharpTextSummarizing\\Program.cs",
29+
"ToolTip": "D:\\1.Projects\\1.Portfolio\\2.OpenSource\\2.Applications_PUSHToGit\\8.CSharp-Text-Summarizer\\CSharpTextSummarizing\\CSharpTextSummarizing\\Program.cs",
30+
"RelativeToolTip": "CSharpTextSummarizing\\Program.cs",
31+
"ViewState": "AgIAAAAAAAAAAAAAAAAAAB4AAAAAAAAAAAAAAA==",
32+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
33+
"WhenOpened": "2025-06-05T23:17:13.917Z",
34+
"EditorCaption": ""
35+
}
36+
]
37+
}
38+
]
39+
}
40+
]
41+
}
175 KB
Binary file not shown.

0 commit comments

Comments
 (0)