Results 1 to 4 of 4

Thread: Initializing Char variables the easy way

Threaded View

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Initializing Char variables the easy way

    My programming policy prohibits the use of the Microsoft.VisualBasic namespace, this is to ensure good programming practice and future-proofing. There has been only 1 annoying problem with this...

    I was fed up with the non-existant way to give a Char variable an initial value.

    This is my remedy.

    It is a small class that wraps a private byte buffer that allows rapid callup of char values based on their ascii code.

    I'll let the code speak for itself, it is commented with VBCommenter

    If you only have to initialise one or two chars then you might as well do it manually, but for many char assignments (ie in a loop) then this is the most efficient approach (more or less ).

    So if you too find yourself without the VisualBasic namespace, this is my gift to you

    EDIT: UPDATED VERSION WITH AN ASC() FUNCTION
    Attached Files Attached Files
    Last edited by wossname; Mar 17th, 2005 at 10:27 AM.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width