gettingstarted
[Top] [All Lists]

Re: Create Constant for chr(13) and the like.

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Create Constant for chr(13) and the like.
From: Phil Heycock <pheycock at bellsouth dot net>
Date: Wed, 30 Jun 2004 10:13:13 -0400
Delivered-to: gettingstarted at lists dot realsoftware dot com
List-help: <mailto:gettingstarted-request@lists.realsoftware.com?subject=help>
List-id: Getting Started <gettingstarted.lists.realsoftware.com>
List-post: <mailto:gettingstarted@lists.realsoftware.com>
I think "Function CR() As String" is somewhat less verbose.

This approach is also useful with HT, SP, LF, CRLF, EOL, etc. It is also
useful to employ them with defaults. For example:

Function CR(numChrs As Integer = 1)

    Dim i as Integer
    Dim chrTxt As String
    For i = 1 to numChrs
        chrTxt = chrTxt + chr(13)
    Next
    Return chrTxt
End Function

Calling:

msg = "Blah"
msg = msg + CR + "Wahhhh..."

or...

msg = "Blah" + CR(3) + "Wahhhh..."

I keep this stuff in a generic, reusable module 'globalTextFunctions'.

PWH

**************************************************

on 6/30/04 8:59 AM, Deane Venske at deane dot lists at eduss dot com wrote:

> Hey Steve,
> 
> Have you tried EndOfLine? This usually works a treat. Alternatively just
> make a module and a method like :
> 
> Function CharThirteen() As String
> Return Chr(13)
> End Function
> 
> That way you can always use CharThirteen and it will just be whatever the
> return is.
> 
> Deane
> 
>> Hi List.
>> 
>> Quick one.
>> 
>> I'm trying to assign a constant for Chr(13) and the like.   How is this
>> done, I'm going around in circles here.
>> 
>> Thanks,
>> 
>> Steven Taylor
>> Melbourne, Australia.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>