This is a test post to see how well Windows Live Writer works.
This is some block quote
This is back to normal.
This is a test post to see how well Windows Live Writer works.
This is some block quote
This is back to normal.
If you have a string, with some value in it, and you want to pad it out to a certain length, with another character you should check out the PadRight and PadLeft primitives of the String class.
The Functions take two parameters: totalWidth and paddingChar. Here are some examples:
Dim OurString As String = "thisistext" Console.WriteLine(OurString.PadRight(15, "_") ' Result: "thisistext_____"
Dim OurInteger As Integer = 99 Console.WriteLine(OurInteger.ToString.PadLeft(10, "0") ' Result: "0000000099"
If you need to reverse the order of characters in a string, here is a simple way to do it:
Dim OurString As String = "thisistext" Dim CharacterArray() As Char = OurString.ToCharArray() Array.Reverse(CharacterArray) OurString = CharacterArray ' Result: "txetsisiht"
Firstly we assign “thisistext” to OurString. We then create an array, CharacterArray, of type Char. This means each item of the array will contain a single character value.
We then populate CharacterArray with the contents of OurString with the ToCharArray() method. This takes each character in OurString and assigns it to it’s own item in CharacterArray.
Then we call the Array.Reverse function, passing to it CharacterArray. This function takes an array as a parameter and reverses the order of the items.
We then re-assign OurString to equal the now reveresed values of CharacterArray!
This is probably not the most efficient way to reverse a string but it is simple and wrapped up in a function it is quick and easy. If anyone has a more efficient way I’d be interested in hearing about it.
OK then, so that last post I made highlighted that I need to UPDATEincrease the width of my blog. I’ll get on that.
So I fixed the width problem by changing my theme. All is now good.
Well I thought it was time to start up a blog, for several reasons.
Anyway stay tuned!