Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

How to add characters?

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
leeh0003
Asked:
leeh0003
  • 2
  • 2
1 Solution
 
ennixoCommented:
very easy :

TheInputString = "00" & TheInputString
0
 
whose_da_n00bCommented:
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
 
ennixoCommented:
leeh0003 said :
    "my program takes input of 2 ASCII characters"

2 characters
0
 
whose_da_n00bCommented:
oops, nvm mine then, sorry... =$
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now