![]() In the next few examples, you will see a few useful methods used to manipulate strings. For example, you can format a string and make it all uppercase, you can remove spaces, or you can simply count the length of the string. There are many built-in methods available to you, so you can format strings in a number of ways. In this example, the first parameter (myNumber) would appear as £158 and the second one would appear as 25%. StrFormat = String.Format("", myNumber, mySecondNumber) Net Framework becomes useful, as it can detect the user’s country / regional settings and format the piece of text to match those settings. For example, say you wrote Console.WriteLine (“Your balance is £5″) however, if you gave this away to someone in the USA or Italy, they would see the British pound symbol instead of their own country’s currency symbol. The string.format method is useful for formatting your text, and you can format it in many ways. This will print out “thecodingguys is awesome”. For example: Console.WriteLine(myName & " is awesome") You use the & ( or + ) to form a concatenation. It can be very useful when you want to link something together to form a sentence. Concatenation means joining two things together, in this case joining strings.
0 Comments
Leave a Reply. |