Difference between String and string

many times developers talk about this question what is a difference between this String and this string in other words what is difference between the string with the capital “S” and the string with small “s” so in this video we will try to demonstrate what exactly this two things are so what i will do is first let me go and create a variable with name of the capital String and let me give a value here called as Shiv in the same way let me take the small string and create a X2 variable and let me give a value as Shiv here and let me just go and put a debug point let me put a debug point here and let me execute this so you can see basically both of this strings are operating exactly in the same way in other words if i see X1 it also has value Shiv if i see X2 it also has a value Shiv and i can do all the operations for examples if i look at X2 i can go and check the length i can basically go and check max value in the same way if i look at X1 it also has all those methods which the small string has so again coming back to the same questions so what is a difference between the capital String with the “S” the string with the capital “S” and the string with the small “s” so let me just stop this program here now let me hover my mouse onto the small string now you can see when hover my mouse on the small string it is telling me that this string actually point to system dot string which is the capital String you can see over here this one is the capital String here in other words the small string the string with the small “s”is nothing but it’s just alias for the capital String “s” ok so in other words you can call any of them and irrespective what it does it will actually point to the same string class now the thing doesn’t end here now there are lot’s of alias like how we have the string and string so some of the aliases are so the boolean is alias for capital Boolean the byte is the alias for the capital Byte in the same way you can see some other weird aliases for example int is actually alias for int32 so in other words either you use int to declare integer variable or you use int32 it is the same thing in the same way we have unint which is actually equal into Uint32 so next time whenever you get such kind of situation where you think that both of the things are both of the data types are actually pointed to same thing just try to hunt there are any kind of aliases So i hope that this video was useful in this video we will trying to understand that what is the difference between string with a small “s” and string with a capital “S” so summarizing there is nothing but aliases the string with a small “s” is nothing but it’s alias for the capital String


Add a Comment

Your email address will not be published. Required fields are marked *