PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
simple UCase program??
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
simple UCase program??
![]() |
simple UCase program?? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Can someoen show me a simple way to do this?
I want to either read a file or copy and paste text into an Rich text textbox on the form. I then want to hit a button and the program will run through the code and in a label display all of the CAPITAL letters in that document. so if I had this document. i think That Some of The People here do great things. it would show me: TSTP is there a show ucase stament or something, thanks for any help |
|
|
|
#2 |
|
Guest
Posts: n/a
|
No, there is not a built-in function to do that, but you may be interested
in the following functions: Char.IsUpper() Char.IsLower() If you use the ToCharArray() method of the String class to get an array of Chars, you can then use a loop to check each one, sort of like this: Dim original As String Dim capitals As String = "" Dim originalchars() As Char = original.ToCharArray() For Each x As Char In originalchars If Char.IsUpper(x) Then capitals = String.Concat(capitals, x) Next You will need to assign your original string a value in the declaration (or sometime before calling the ToCharArray() method). Depending on the length of your original string, you may want to use the System.Text.StringBuilder class for the capitals variable for the sake of efficiency, but that is your decision. Hopefully this helps. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/ "Jason" <paul814@excite.com> wrote in message news:9a618680-bd22-409a-9328-4ef8ddda4d7b@l42g2000hsc.googlegroups.com... > Can someoen show me a simple way to do this? > > I want to either read a file or copy and paste text into an Rich text > textbox on the form. I then want to hit a button and the program will > run through the code and in a label display all of the CAPITAL letters > in that document. > > so if I had this document. > > i think That Some of The People here do great things. > > it would show me: > TSTP > > is there a show ucase stament or something, thanks for any help |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Jason <paul814@excite.com> wrote in news:9a618680-bd22-409a-9328-
4ef8ddda4d7b@l42g2000hsc.googlegroups.com: > i think That Some of The People here do great things. > > it would show me: > TSTP You can either use Regular Expressions or String Parsing to do this. A simple RegEx to find uppercase characters would be [A-Z]. Then you can loop through all the matches and display it to the user. -- spamhoneypot@rogers.com (Do not e-mail) |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Or you can use LINQ syntax in VB9 (2008) to make this :
Dim capitals As String = (From c In original Where Char.IsUpper(c)).ToArray "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message news:Os1C3rfkIHA.5260@TK2MSFTNGP03.phx.gbl... > No, there is not a built-in function to do that, but you may be interested > in the following functions: > > Char.IsUpper() > Char.IsLower() > > If you use the ToCharArray() method of the String class to get an array of > Chars, you can then use a loop to check each one, sort of like this: > > Dim original As String > Dim capitals As String = "" > Dim originalchars() As Char = original.ToCharArray() > For Each x As Char In originalchars > If Char.IsUpper(x) Then capitals = String.Concat(capitals, x) > Next > > You will need to assign your original string a value in the declaration > (or sometime before calling the ToCharArray() method). Depending on the > length of your original string, you may want to use the > System.Text.StringBuilder class for the capitals variable for the sake of > efficiency, but that is your decision. Hopefully this helps. > -- > Nathan Sokalski > njsokalski@hotmail.com > http://www.nathansokalski.com/ > > "Jason" <paul814@excite.com> wrote in message > news:9a618680-bd22-409a-9328-4ef8ddda4d7b@l42g2000hsc.googlegroups.com... >> Can someoen show me a simple way to do this? >> >> I want to either read a file or copy and paste text into an Rich text >> textbox on the form. I then want to hit a button and the program will >> run through the code and in a label display all of the CAPITAL letters >> in that document. >> >> so if I had this document. >> >> i think That Some of The People here do great things. >> >> it would show me: >> TSTP >> >> is there a show ucase stament or something, thanks for any help > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

