Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/powerbliz00/alphabet

a simple program sorts lowercase alphabet to uppercase, printing each letter in one line using c# methods
https://github.com/powerbliz00/alphabet

alphabet-sorting c-sharp string-manipulation string-sorting string-split uppercase-conversion variable-conversion

Last synced: 3 days ago
JSON representation

a simple program sorts lowercase alphabet to uppercase, printing each letter in one line using c# methods

Awesome Lists containing this project

README

        

# Uppercase Alphabet

This simple C# program demonstrates how to convert lowercase letters to uppercase using the `ToUpper()` method.

## Code Explanation

The code iterates through the lowercase alphabet and converts each letter to uppercase using the `ToUpper()` method. It then prints the uppercase letters to the console.

```C#
using System;

public class Program
{
// C# Main method - The program start here
static void Main(string[] args)
{
string alphabet = "abcdefghijklmnopqrstuvwxyz";
// Iteration in each letter in the alphabet string
foreach (char letter in alphabet){
// definition of new variable 'letterCapitalCase' for converting char type into string output
string letterCapitalCase = letter.ToString().ToUpper();
// Output method
Console.WriteLine(letterCapitalCase);
}
}
}
```

## Running the Program

### Windows

1. **Install .NET SDK:** If you don't have it already, download and install the .NET SDK from [https://dotnet.microsoft.com/download](https://dotnet.microsoft.com/download).
2. **Compile the code:** Open a command prompt and navigate to the directory containing the C# file (`Program.cs`). Run the following command to compile the code:
```bash
dotnet build
```
3. **Run the program:** Execute the following command to run the compiled program:
```bash
dotnet run
```

### Linux

1. **Install .NET SDK:** Install the .NET SDK using your distribution's package manager. For example, on Ubuntu:
```bash
sudo apt update
sudo apt install dotnet-sdk-6.0
```
2. **Compile the code:** Open a terminal and navigate to the directory containing the C# file (`Program.cs`). Run the following command to compile the code:
```bash
dotnet build
```
3. **Run the program:** Execute the following command to run the compiled program:
```bash
dotnet run
```

## Output

The program will output the uppercase alphabet to the console, one letter per line:

```
A
B
C
...
Z
```

This repository serves as a basic example of string manipulation in C# and demonstrates the use of the `ToUpper()` method
and the need of `Type conversion from char type from string type, using ToString() method`.