473,320 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

.text / String Manipulation

tma
I have a web form where users enter basic information such as their name and
address. How can I ensure that when that data gets written to the database
it gets "converted" to first letter capital, all others lower case? For
example "john doe" would go into the database as "John Doe". Is there an
easy way to do this?
Nov 20 '05 #1
3 1267
Thats called "Proper Case" Here's a little function for you.

'Any characters capitalized to begin with will remain so
'USA will still be USA
Function ProperCase(ByVal text As String) As String
Dim i As Integer
Dim mProperCase As String
' prepare the result
mProperCase = StrConv(text, vbProperCase)

' restore all those characters that were capitalized
For i = 1 To Len(text)
Select Case Asc(Mid$(text, i, 1))
Case 65 to 90 'A-Z
Mid$(mProperCase, i, 1) = Mid$(text, i, 1)
End Select
Next
Return mProperCase
End Function

Regards
Jerry

"tma" <tm*@allisconfusing.net> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
I have a web form where users enter basic information such as their name and address. How can I ensure that when that data gets written to the database
it gets "converted" to first letter capital, all others lower case? For
example "john doe" would go into the database as "John Doe". Is there an
easy way to do this?

Nov 20 '05 #2
tma
Thank you for the speedy reply. That's exactly what I was looking for.
"Jerry" <Je*********@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Thats called "Proper Case" Here's a little function for you.

'Any characters capitalized to begin with will remain so
'USA will still be USA
Function ProperCase(ByVal text As String) As String
Dim i As Integer
Dim mProperCase As String
' prepare the result
mProperCase = StrConv(text, vbProperCase)

' restore all those characters that were capitalized
For i = 1 To Len(text)
Select Case Asc(Mid$(text, i, 1))
Case 65 to 90 'A-Z
Mid$(mProperCase, i, 1) = Mid$(text, i, 1)
End Select
Next
Return mProperCase
End Function

Regards
Jerry

"tma" <tm*@allisconfusing.net> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
I have a web form where users enter basic information such as their name

and
address. How can I ensure that when that data gets written to the database it gets "converted" to first letter capital, all others lower case? For
example "john doe" would go into the database as "John Doe". Is there an
easy way to do this?


Nov 20 '05 #3
Here is one idea:

Public Shared Function ProperCase(ByVal input As String) As String
Return
System.Threading.Thread.CurrentThread.CurrentCultu re.TextInfo.ToTitleCase(in
put)
End Function

--
Joe Fallon


"tma" <tm*@allisconfusing.net> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
I have a web form where users enter basic information such as their name and address. How can I ensure that when that data gets written to the database
it gets "converted" to first letter capital, all others lower case? For
example "john doe" would go into the database as "John Doe". Is there an
easy way to do this?

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Patrick | last post by:
Hello, after learning that I was taking a class in VB.NET, I have been drafted to solve all my companies VB/scripting problems - hey, I should know everything; I've already taken 6 classes ;) I...
1
by: Andrew Poulos | last post by:
Say I have a page, which has been created by a third party, and the page may contain some pre-specified text. How can I find and replace that text dynamically? For example, if the page I have...
5
by: ad | last post by:
I want to delete some text which begin with <!DOCTYPE and end with > in a file. How can I do it?
2
by: UJ | last post by:
I've got a text box that I'm going to be doing some manipulation on (selecting text, moving stuff around, that kind of thing) but I don't want/need the user to see it while it's going on. I'd like...
4
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if...
3
by: Alois Treindl | last post by:
A simple XSL question from a newbie: In an xml document which I transform via xsl into html output, I have some text which I want to be suppressed. The tags looks like this <anchor_ref...
6
by: garyusenet | last post by:
Hi i would like to trim a text string. I have a text string called filename I want to display just the file in my label, and not the path. Can someone tell me how I get everything AFTER, the...
0
by: JosAH | last post by:
Greetings, welcome back; above we discussed the peripherals of the Library class: loading and saving such an instantiation of it, the BookMark interface and then some. This part of the article...
1
by: blangela | last post by:
Bjarne Stroustrup has a new text coming out called "Programming: Principles and Practice Using C++" (ISBN: 0321543726), due to be published in December of this year. Some of the features of this...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.