Learn C# for beginners: 7 - Using the String Data Type
Вставка
- Опубліковано 22 жов 2024
- If you enjoyed this video please comment below and give me a thumbs up! It goes a long way.
If you want to keep watching these videos make sure to subscribe!
You can contact me at:
Twitter: / jdprogramming
For business Inquires please email at: JDProgramming@Outlook.com
Hoping to learn much more on the way. This is marvellous material.
Excellent work.
Very good explanation
Indeed Excellent!
Learn C# for beginners: 7 - Using the String Data Type
String name1 = "Bob";
String name2 = "Bob";
(different ways of comparing)
bool namesEqual = name1 == name2;
bool namesEqual = string.Equals(name1, name2);
int namesEqual = string.Compare(name1, name2); (does not return true or false but returns a value -1 0 1 )
int namesEqual = name1.CompareTo(name2); (different way of comparing)
To see how many characters a name has
Console.WriteLine("{0} has {1} charachters", name1,name1.Length);
Get a portion of a string
string firstCharachters = name1.Substring(0, 1); (0 is the start, 1 is how many characters from start do you want. )
Does the string Startwith?
bool startsWith = name1.StartsWith ("Jess");
Functions for strings
-string.equal(argument1,argument2)
-string.compare(argument1,arg2)
-arg1.compareto(arg2)
-argument.lenght
-argument.startwith("string/char")
argument.substring(index,number of char)
ever tried to align the slashes for the comments, lol
C# has too many in build function.
Subprograms makes c# very good and easy than c programming in which you build a function to compare