what is wrong with this ? (assuming s is > 1 char long)
Dim s As String
s = s.ToUpper(s.Substring(1, 1)) & s.ToLower(s.Substring(2)) 11 2523
Hi John,
Here's a .NET gotcha. A String, like an array, like practically everything
now, starts counting from 0.
s.Substring (1, 1) is the 2nd character
s.Substring (2) is the 3rd character onwards.
Also the Mid Left and Right functions from VB6 are very forgiving
(sensibly and usefully so) but the String class functions are not. Go out of
range with these and it's Exception time.
You can still use Mid if you wish.
Regards,
Fergus
John,
In addition to Fergus's comments.
String.ToUpper does not accept a string as a parameter. It operators on the
current instance of the string. So if you want the upper case the first
character of "s" you would use:
s = s.SubString(0, 1).ToUpper()
As Fergus pointed out the index is zero based, so to get the first character
of "s" you pass 0, then you upper case the result of the sub string.
Of course you could have upper cased the entire string then took the sub
string of that.
s = s.ToUpper().SubString(0, 1)
Hope this helps
Jay
"John A Grandy" <jo*********@yahoo.com> wrote in message
news:eq*************@TK2MSFTNGP11.phx.gbl... what is wrong with this ? (assuming s is > 1 char long)
Dim s As String
s = s.ToUpper(s.Substring(1, 1)) & s.ToLower(s.Substring(2))
Or
str = StrConv(str, vbProperCase)
Is easier ;-D
================================================== ===
"John A Grandy" <jo*********@yahoo.com> wrote in message
news:eq*************@TK2MSFTNGP11.phx.gbl... what is wrong with this ? (assuming s is > 1 char long)
Dim s As String
s = s.ToUpper(s.Substring(1, 1)) & s.ToLower(s.Substring(2))
What time did you actually post this ?
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Hi John,
Here's a .NET gotcha. A String, like an array, like practically
everything now, starts counting from 0.
s.Substring (1, 1) is the 2nd character s.Substring (2) is the 3rd character onwards.
Also the Mid Left and Right functions from VB6 are very forgiving (sensibly and usefully so) but the String class functions are not. Go out
of range with these and it's Exception time.
You can still use Mid if you wish.
Regards, Fergus
Hi OMH,
I found this funny, I thought what was it, I was searching on OHM and then I
saw you did post it again.
Now I have saved it..
Cor
Sorry cor, what post of mine did u save ?
OHM
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl... Hi OMH, I found this funny, I thought what was it, I was searching on OHM and then
I saw you did post it again. Now I have saved it.. Cor
Hi OHM
That string conversion, you had a long discussion with Herfried about that a
while ago, and I was laughing about it.
So I thought that I d'nt forget.
(You won the discussion )
I thought I d'nt know if you where in this newsgroup today, so I started
searching for it, because I thougth that is the answer.
Could not find it in MSDN and started to search for your messages, then I
saw you had answered it.
So now I have saved your solution in a seperate map.
:-)
Cor
Aha,
I see what you mean.
;-D
"Cor" <no*@non.com> wrote in message
news:3f*********************@reader22.wxs.nl... Hi OHM That string conversion, you had a long discussion with Herfried about that
a while ago, and I was laughing about it. So I thought that I d'nt forget. (You won the discussion ) I thought I d'nt know if you where in this newsgroup today, so I started searching for it, because I thougth that is the answer. Could not find it in MSDN and started to search for your messages, then I saw you had answered it.
So now I have saved your solution in a seperate map.
:-)
Cor
Hi OHM,
2:18am as it says.
Why do you ask?
Regards,
Fergus
Even Borgs have to regenerate, you dont seem to sleep ever. Your post start
really early as well.
;-D
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl... Hi OHM,
2:18am as it says.
Why do you ask?
Regards, Fergus
Morning OHM,
ROFL. That's a good 'un. Borg's ain't got a patch on me. Hmm, perhaps
patch is the wrong word there.
One theory is that I'm actually asleep right now and this is my astral
body using telekenesis to type.
;-)
Regards,
Fergus
ps. Did you see my response to your Troll comment? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dim |
last post by:
I found that C# has some buggy ways to process string across methods.
I have a class with on global string var and a method where i add / remove
from this string
Consider it a buffer... with some...
|
by: tshad |
last post by:
Can you do a search for more that one string in another string?
Something like:
someString.IndexOf("something1","something2","something3",0)
or would you have to do something like:
if...
|
by: zoro |
last post by:
Hi,
I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party
string handling library that includes some very useful string
functions, in particular I'm interested in BEFORE (return...
|
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...
|
by: micklee74 |
last post by:
hi
if i have a some lines like this
a ) "here is first string"
b ) "here is string2"
c ) "here is string3"
When i specify i only want to print the lines that contains "string" ie
the first...
|
by: Niyazi |
last post by:
Hi,
Does anyone knows any good code for string manipulation similar to
RegularExpresion?
I might get a value as string in a different format. Example:
20/02/2006 or 20,02,2006 or ...
|
by: crprajan |
last post by:
String Manipulation: Given a string like “This is a string”, I want to remove all single characters( alphabets and numerals) like (a, b, 1, 2, .. ) .
So the output of the string will be “This is...
|
by: Frinavale |
last post by:
I currently have a .NET application that has an object which passes a string (a connection string) as a parameter to another object that does database manipulation.
This string isn't stored...
|
by: frankeljw |
last post by:
I have 2 Java strings
1st String is a series of names, colons, and numbers
ie) Name1:13:Name2:4526:Name3:789:Name4:3729:Name5:6:Name6:44
2nd String is a name
ie) Name2
I need to get the...
|
by: mann_mathann |
last post by:
can anyone tell me a solution:
i cannot use the features in standard c++ string classgh i included
the string.h file but still its not working.
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |