Philippians 4:6
“Don’t worry about anything, but in everything, through prayer and petition with thanksgiving, let your requests be made known to God.”
C# code often takes preexisting values and creates new values that are displayed, saved in files, and sent across various networks. C# provides several ways to combine & format this data.
Character Escape Sequences w/ “\”
An escape character sequence is “an instruction to the runtime to insert a special character that will affect the output of your string.”
New Lines: “\n”
Console.WriteLine("Hello\nWorld!");
Console.WriteLine("This is my first line.\nThis is my second line.\nThis is my third line.");
The output should look like this:
Tabs: “\t”
Console.WriteLine("Jesus\tLoves\tYou");
Console.WriteLine("Genesis 1:1\t HCSB\nIn the beginning was the Word,\nand the Word was with God,\nand the Word was God.");
The output should look similar:
A string that contains Quotations: \”the words quoted, go here, in between\”
For our purposes, I will change the \” into blue.
string John2_5_HCSB = "\"Do whatever He tells you,\" His mother told the servants.";
Console.WriteLine(John2_5_HCSB);
The output for the escape character sequence for quotes in a string should look similar to this:
A string that displays a file path: “\\”
For our purposes, I will highlight the \” in blue & the \\ in red.
string filePath_1 = "\"C:\\User\\Documents\" .";
Console.WriteLine("This is the correct filepath for Document X: " +filePath_1);
The output for displaying a backslash & using quotes would look like this:
Using the class & method: string.Format();
string.Format(); is a helpful method. Here is code I made to run a simple program that adds strings together.
The first variable string addedText is not using the string.Format(); class & method.
The additional variables are using string.Format();
This code produced this output:
.ToLower() & .ToUpper()
The .ToLower() method will change all the letters in a string to lowercase capitalization.
The .ToUpper() method will change all the letters in a string to upper-case capitalization.
Here is some code that demonstrates the .ToLower() and .ToUpper() method
Here is the output:
Fun w/ .ToLower()
I have created a fun string application that uses a conditional loop. The loop produces different output depending on the user input.
Here is the code for this short string application using the .ToLower() method.
Here are the three potential Outputs:
Option 1:
Option 2:
Option 3:
Philippians 4:6
“Don’t worry about anything, but in everything, through prayer and petition with thanksgiving, let your requests be made known to God.”
Leave a Reply