Solved

How to add characters?

Posted on 2003-11-23
4
197 Views
Last Modified: 2010-05-01
Gd evening,

my program takes input of 2 ASCII characters. However, when I store this data, it has to be in 4 byte format thus eg: 18 has to be 0018 before it can be stored. Could anyone enlightment me on this subject ?
0
Comment
Question by:leeh0003
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
ennixo earned 50 total points
ID: 9805743
very easy :

TheInputString = "00" & TheInputString
0
 

Expert Comment

by:whose_da_n00b
ID: 9805914
the above one adds 00 to everything -- therefore 100 would become 00100 not 0100.

if TheInputString <= 9 then TheFinalString = "000" & TheInputString
if TheInputString <= 99 then TheFinalString = "00" & TheInputString
if TheInputString <= 999 then TheFinalString = "0" & TheInputString
if TheInputString <= 9999 then TheFinalString = TheInputString

use that instead. that makes single digit number 000#, double digit numbers 00##, triple digit numbers 0### and quad-digit numbers ####
0
 
LVL 5

Expert Comment

by:ennixo
ID: 9805930
leeh0003 said :
    "my program takes input of 2 ASCII characters"

2 characters
0
 

Expert Comment

by:whose_da_n00b
ID: 9805936
oops, nvm mine then, sorry... =$
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now