more fun with strings

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-29 13:10:49 +01:00
parent 8d9bff7215
commit 9e1cff95ed

View file

@ -2,16 +2,16 @@
{ {
public class Program public class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
bool ignoreCase = true; bool ignoreCase = true;
string option = "/help"; string option = "/help";
int comparison = string.Compare(option, "/Help", ignoreCase); int comparison = string.Compare(option, "/Help", ignoreCase);
bool isHelpREquested = (comparison == 0); bool isHelpREquested = (comparison == 0);
Console.WriteLine($"Help Requested: {isHelpREquested}"); Console.WriteLine($"Help Requested: {isHelpREquested}");
Console.WriteLine("\u0029"); Console.WriteLine("\u0029");
Console.WriteLine(@" Console.WriteLine(@"
, , , ,
/( )` /( )`
@ -34,7 +34,8 @@
`--{__________) \/ `--{__________) \/
"); ");
Console.WriteLine(@" Console.WriteLine(
@"
@ -75,26 +76,49 @@
"); ");
string name = "mobius"; string name = "mobius";
Console.Write( Console.Write(
$$""" $$"""
Begin Begin
____ ____
/ /\ / /\
/ / \ / / \
/ / /\ / / /\
/ / / \ / / / \
/ / /\ \ / / /\ \
/ / / \ \ / / / \ \
/ / /\ \ \ / / /\ \ \
/ / / \ \ \ / / / \ \ \
/___/___/____\ \ \ /___/___/____\ \ \
/ {{{name}}} \ \ \ / {{{name}}} \ \ \
/________________\ \ \ /________________\ \ \
\ \ \ / \ \ \ /
\_________________\___\/ \_________________\___\/
End End
"""); """);
} string mamaSaid = // Multi-line raw string literal.
"""
Mama said, "Life was just a box of chocolates..."
""";
string jsonDialogue = $$"""
{
"quote": {
"character": "The MAN",
"dialogue": ""
},
"description": "She nods, not much interested. He...",
"quote": {
"character": "The MAN",
"dialogue": ""
},
"description": "She shakes \"no\" He unwraps it...",
"quote": {
"character": "The MAN",
"dialogue": "{{mamaSaid.Replace("\"", "\\\"")}}"
}
}
""";
Console.WriteLine(jsonDialogue);
}
} }
} }