Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

String Constants (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Open copmuters default browser and go to a predefined url
Next thread: Web edition, e-commerce & certificates


Re: [OT] Large Screenshots   -   Rubber Chicken Software Co.
  String Constants   -   wagnerj proaxis.com
   Re: String Constants   -   Craig Finseth
   Re: String Constants   -   wagnerj proaxis.com
   Re: String Constants   -   Rick Praetzel
   Re: String Constants   -   Charles Yeomans

String Constants
Date: 02.08.11 16:49 (Tue, 2 Aug 2011 08:49:32 -0700 (PDT))
From: wagnerj proaxis.com
Greetings NUG -

This ought to be simple, but I am missing something.

I would like to define a character as a constant in a module for global
use. In particular, HTAB.

If I put char(9) as the value, the constant becomes the string, "char(9)",
not the single character, char(9). So, how can I define a constant that is
NOT a printable ASCII character?

Many thanks
Jim Wagner
Oregon Research Electronics

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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: String Constants
Date: 23.03.01 20:27 (Tue, 2 Aug 2011 13:07:10 -0500 (CDT))
From: Craig Finseth
On Aug 2, 2011, at 11:49 AM, <email address removed> wrote:

> Greetings NUG -
>
> This ought to be simple, but I am missing something.
>
> I would like to define a character as a constant in a module for global
> use. In particular, HTAB.
>
> If I put char(9) as the value, the constant becomes the string, "char(9)",
> not the single character, char(9). So, how can I define a constant that is
> NOT a printable ASCII character?

Copy a tab and paste it into the editor. If you can tolerate the overhead of a few function calls, you can also do something like the following.

Function HTAB(extends t as TextEncoding) As String
return t.Chr(9)
End Function

This would allow you to write code like

dim intendedRow as String = Encodings.UTF8.HTAB + text

A compromise between these two is what I tend to use. I have a global
module with miscellaneous constants and utility functions that I
include in all of my projects. (You can use your App module if you
don't have your own global module.)

In your module, create a global string property. Have an initializer
and set it once. You can then refer to it from everywhere.

This has the advantage that you can calculate various "constants" once
(e.g., end-of-line before Real Software added it) and just refer to it
efficiently.

Craig

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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: String Constants
Date: 02.08.11 17:24 (Tue, 2 Aug 2011 09:24:45 -0700 (PDT))
From: wagnerj proaxis.com
Thanks

Jim

>
> On Aug 2, 2011, at 11:49 AM, <email address removed> wrote:
>
>> Greetings NUG -
>>
>> This ought to be simple, but I am missing something.
>>
>> I would like to define a character as a constant in a module for global
>> use. In particular, HTAB.
>>
>> If I put char(9) as the value, the constant becomes the string,
>> "char(9)",
>> not the single character, char(9). So, how can I define a constant that
>> is
>> NOT a printable ASCII character?
>
> Copy a tab and paste it into the editor. If you can tolerate the overhead
> of a few function calls, you can also do something like the following.
>
> Function HTAB(extends t as TextEncoding) As String
> return t.Chr(9)
> End Function
>
> This would allow you to write code like
>
> dim intendedRow as String = Encodings.UTF8.HTAB + text
>
> Charles Yeomans
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>


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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: String Constants
Date: 02.08.11 17:22 (Tue, 2 Aug 2011 10:22:19 -0600)
From: Rick Praetzel

On Tuesday, Aug 2, 2011, at 10:13 AM, Charles Yeomans wrote:

> Copy a tab and paste it into the editor. If you can tolerate the overhead of a few function calls, you can also do something like the following.
>
> Function HTAB(extends t as TextEncoding) As String
> return t.Chr(9)
> End Function
>
> This would allow you to write code like
>
> dim intendedRow as String = Encodings.UTF8.HTAB + text


I am always learning from you.
Not sure how to say thanks, but Thanks.

Rick
(not the original poster)

Rick Praetzel
Desert Sand Software
www.desertsandsoftware.com
RB 2011r1
2.8 GHz Intel Core Quad Imac,
8GB RAM, OSX 10.6
MesaMySQL database browser/editor
MesaSQLite database browser/editor


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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: String Constants
Date: 02.08.11 17:13 (Tue, 2 Aug 2011 12:13:53 -0400)
From: Charles Yeomans

On Aug 2, 2011, at 11:49 AM, <email address removed> wrote:

> Greetings NUG -
>
> This ought to be simple, but I am missing something.
>
> I would like to define a character as a constant in a module for global
> use. In particular, HTAB.
>
> If I put char(9) as the value, the constant becomes the string, "char(9)",
> not the single character, char(9). So, how can I define a constant that is
> NOT a printable ASCII character?

Copy a tab and paste it into the editor. If you can tolerate the overhead of a few function calls, you can also do something like the following.

Function HTAB(extends t as TextEncoding) As String
return t.Chr(9)
End Function

This would allow you to write code like

dim intendedRow as String = Encodings.UTF8.HTAB + text


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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>