Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How to get my capital letter back?


Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2007, 09:07 AM
s01655468 s01655468 is offline
Freshman
 
Join Date: Mar 2003
Posts: 35
Default How to get my capital letter back?


I need some help please.

I have some cipher text, like Abc dEf ghI for example. In order to simplify deciphering, i convert all to lower case.

Therefore, my decoded message become like: i am a boy.
Anyone can advice me how to retain or get back the cap letter, for example my original msg is: I am a Boy.

-----------------------------
For my deciphering,
I put letter a-z into an array.
I make sure the cipher letter match letter in my array, then i decipher using the keyword.

I'm thinking of making another array for cap letter A-Z, so i dont need to convert to lowercase beforehand; but i feel that's very stupid becos each cipher text letter i need to comare again 52 letter!

Anyone advice, thank!
Reply With Quote
  #2  
Old 03-28-2007, 10:05 AM
madcat1990's Avatar
madcat1990 madcat1990 is offline
Centurion
 
Join Date: Aug 2006
Location: Portugal
Posts: 120
Default

Lcase is to put in lower case
Ucase is to put in upper case


did that help?
__________________
Google is your friend | xtremeVBtalk.com is also your friend :D
Reply With Quote
  #3  
Old 03-28-2007, 10:42 AM
moa moa is offline
Contributor
 
Join Date: Oct 2006
Posts: 483
Default

Hello,

Lcase and Ucase would modify the whole text...
I presume you are looking for using back to Ucase only for the letters which were on Ucase before the transformation of the whole text using Lcase !

It sounds like homework to me...

I will then content myself by saying that you need to use a loop before the Lcase transformation and to memorize the position of each letter affected by lowcase ...

It's easy...
Reply With Quote
  #4  
Old 03-28-2007, 11:02 AM
ElderKnight ElderKnight is offline
Senior Contributor

Forum Leader
 
Join Date: Oct 2003
Location: Central Florida
Posts: 1,205
Default

If you still have the original (encoded) string, you could step through it one character at a time (Mid$() function, checking the ascii (Asc() function) value of each character. If that number indicates a capital, then cap the corresponding letter in the new (decoded) string as you step through in parallel.

EDIT: If you'v already got each character in an array cell, that's even easier. You don't need Mid$() at this point: just loop through your array.
__________________
-- D.J.

I do not endorse any items advertised within this frame, and regret that the viewer is subjected to such.
Reply With Quote
  #5  
Old 03-29-2007, 09:46 AM
s01655468 s01655468 is offline
Freshman
 
Join Date: Mar 2003
Posts: 35
Default

Thk to all who replied to my thread. moa, ElderKnight and madcat1990.

hi moa, you're half right, this is not my homework, if it is, i properly wont even post, haha. It's my assignment.

Btw, i found a solution, it took me almost a day to figure out this simple solution, i nearly wan to hit myself for such an easy thing.

All i have to do is before before my Lcase code, i put a boolean, ya just 1 line, a boolean........
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->