Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Capitalize a string
 

Capitalize a string

I want to ask if is there any way to capitalize an entire string, so that a string looking like

QweRtY

can be automatically changed into

QWERTY

Thanks a lot!!
Xi0N  Wednesday, January 10, 2007 10:06 AM
http://msdn2.microsoft.com/en-us/library/53e2ew8a.aspx

Seems like next time i should searcha bit more before posting...

Thanks anyway ;)
Xi0N  Wednesday, January 10, 2007 11:24 AM
http://msdn2.microsoft.com/en-us/library/53e2ew8a.aspx

Seems like next time i should searcha bit more before posting...

Thanks anyway ;)
Xi0N  Wednesday, January 10, 2007 11:24 AM
Actually, what i need now is a function that can change characters like

á é í ó ú

into

a e i o u

Thanks and sorry for posting so many replyes :P
Xi0N  Wednesday, January 10, 2007 11:37 AM

The method below should cater for this, the sourceString can be either single characters or complete strings.

Public Function convertCharacters(ByVal sourceString As String) As String

Dim resultString As String = ""

resultString = sourceString.Replace("á", "a")

resultString = sourceString.Replace("é", "e")

resultString = sourceString.Replace("í", "i")

resultString = sourceString.Replace("ó", "o")

resultString = sourceString.Replace("ú", "u")

Return resultString

End Function

Hope this help!

Quantumnus  Friday, January 12, 2007 3:37 PM

There's a couple of ways to skin this one,

Dim source As String

Dim target As String

target = UCase(source)

target = source.ToUpper (+1 overload)

Quantumnus  Friday, January 12, 2007 3:48 PM

You can use google to search for other answers

Custom Search

More Threads

• How to Protect an area of code
• Reading an array of bytes (for new users)
• how to store pictures in database
• How to drop down items in listview or datagrid?
• Visual Inheritance problem in CF2.0
• Inherits or Implements?
• Sending Activeworkbook with body
• Adding list items from delimited text file
• access local printer from web application
• REading emails from exchange 2000