473,473 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Capitalizing String or Char by position ( vb.net)

36 New Member
I have a string " Hello World ", I've reversed the string to " olleH dlroW " now I would like to change the position of the Capitalized letters to Olleh Dlrow. By the way I do not want to capitalize the first letter of every word, I want to replace the capitalization by position such as wAiter to rEtiaw. Does anyone have any suggestions?

Thanks,
Wbosw
Nov 3 '07 #1
3 5748
balabaster
797 Recognized Expert Contributor
I have a string " Hello World ", I've reversed the string to " olleH dlroW " now I would like to change the position of the Capitalized letters to Olleh Dlrow. By the way I do not want to capitalize the first letter of every word, I want to replace the capitalization by position such as wAiter to rEtiaw. Does anyone have any suggestions?

Thanks,
Wbosw
Can you provide some clarification?

What if the current position of a capital letter falls where a space would fall or not fall at the beginning of the word in the reversed string? For instance in Hello World both words are the same length. If I started with Hello Barb then my upper case would fall on characters 1 and 7 which would result in Brab oLleh. If I were to start with Barb Hello then my upper case falls on 1 and 6 which when reversed would be Olleh brab and I would lose one of my upper case characters. In this instance would you need the upper moved forward a character to catch the b like Brab? Would the resulting string need to be Olleh Brab?
Nov 3 '07 #2
wbosw
36 New Member
There are no spaces between the words, the string is split into an array and each word is an item within the array. I loop through the array and reverse the words.

Wbos
Nov 3 '07 #3
balabaster
797 Recognized Expert Contributor
There are no spaces between the words, the string is split into an array and each word is an item within the array. I loop through the array and reverse the words.

Wbos
So would you be reversing each word and capitalizing the first letter of each reversed word before concatenation? Or are you just taking the original character position within the overall string?

If you're doing the former, I might be tempted to do something like the following:
Pseudo Code
Expand|Select|Wrap|Line Numbers
  1. Split the string on space
  2. Loop through the resulting array of strings
  3.   Loop through the string
  4.     Check the state of capitalized letters within the string storing positions of the capital letters in an array
  5.   End Loop
  6.   Reverse the string.
  7.   Loop through each value in the case state array
  8.     Capitalize each of the characters at the position stored in the array 
  9.   End Loop
  10. End Loop
  11. Concatenate strings back together
If performance is an issue though, this process could be a little restrictive...it's perhaps not the most efficient process...but I don't think there's a method that will give you a list of the positions of capitalized characters in a string...so you'd have to write one of your own.
Nov 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ofir | last post by:
is it possible to recognize a "right to left" char with .net? in Java it's Character.getDirectionality() but i could'nt find it in vb.net
1
by: Peter | last post by:
Hi. How can I detect char index(position of char) in richtextbox from place where is cursor blinking. Thanks from answer.
2
by: anelma via .NET 247 | last post by:
Following code works fine, when compiled with VS 6.0, but not anymore when compiled in .NET. What's wrong here, I can't see it by myself? arrString content will be garbage with .net compilation, but...
3
by: Bob | last post by:
Hi, I have written a VC++ dll which talks to a Borland C++ dll which needs to return a string to the VB calling exe. I thought that if I passed in a stringbuilder by Ref from the VB code the...
2
by: bhavik | last post by:
hi i want to know how to hide the values in query string in ASP.net. here i want to send the values from one page to another page through query string with out explicitly visible the values in...
3
by: Zach | last post by:
Hello, This might be a rather basic question, but I've tried a few things and I can't really find a solution as elegant as what I'd like for this problem. The situation is this - I have a file...
1
by: TDK02 | last post by:
Hi, I need someones help to Convert C++ strings to a C-style string (char*) in VC++ 6.0. What I need to do is something as follows. There is a string as, string sh = “hello”;
1
by: foocc | last post by:
Hi, i would like to know how should i set my connection string in vb.net? In my VB6 code, this is how i set my connection string: conDetail.ConnectionString =...
4
by: HPATEL | last post by:
Hi, I have a connection string in vb.net as below with access db. Public Const OLEDB_CONNECTION_STRING As String = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.