Showing posts with label String. Show all posts
Showing posts with label String. Show all posts

Thursday, January 24, 2013

Capitalize the First Letter of each Word in a String

There is a built in .NET method to capitalize the first letter of each word in a string:

newStr = Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(str)

This is easier than writing the function to do it.

I found this at:

http://www.vbforums.com/showthread.php?557905-Uppercase-first-letter-in-each-word-of-a-string.

Friday, June 5, 2009

Converting a Byte Array to a String in VB.NET

Here is one way to convert a byte array to a String in VB.NET:


Dim bArray() As Byte = {65, 66, 67, 68, 69}
Dim str As String
str = System.Text.Encoding.ASCII.GetString(bArray)



More examples of converting Byte Arrays to Strings and vice versa in VB.NET and C# can be found here:

http://www.chilkatsoft.com/faq/DotNetStrToBytes.html