Difference between $ and .s ?

Everything else that doesn't fall into one of the other PB categories.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Difference between $ and .s ?

Post by Karbon »

Someone just told me that there was a difference between

mystring$ and mystring.s

Can someone smack me around with a clue stick? Either I've overlooked it in the docs or the difference isn't in there..

Thanks!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

As far as i know there's no difference... correction there is one difference that i can see -it's that you get to type in one less character with the non-$-version when you use it later in your program ;)
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Simple, there is no diffrent.

ok, only one

after:
String.s="Hello"
you can write
String+" everyone".

with $, you must allways add the $.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Another difference is that this is allowed

Code: Select all

A$ = "Hello"
A.l = 5
But this is not

Code: Select all

A.s = "Hello"
A.l = 5
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Thanks guys :-)
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
matthew180
User
User
Posts: 64
Joined: Mon Jun 30, 2003 5:36 pm
Location: Michigan
Contact:

Post by matthew180 »

The $ and .s internal variable spaces are not the same.

a$ = "Hello"
a.s = "World"
debug a$
debug a.s

Output:
Hello
World

You would *expect* the result to be:

World
World

Seems the $ is just like the * is to pointers, i.e. is becomes part of the variable name and not really any sort of operator. Once you define a pointer, you have to always use the * with the name, same with the $ for strings.

Now, as for the difference between variables defined with a $ or .s, unfortunately only Fred can tell you that...

Matthew
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It's for BASIC compatibility, MyVar is different than MyVar$. That's it. In PB, I've added the .s for those which gets bored with the ended '$', but it's exactly the same internally.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Exxxxxcellent. Thanks Fred.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Post by TronDoc »

Fred wrote:It's for BASIC compatibility
I appreciate being able to use the '$' :D Joe
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

TronDoc wrote:
Fred wrote:It's for BASIC compatibility
I appreciate being able to use the '$' :D Joe
sorry joe, $ sounds to american ;)
SPAMINATOR NR.1
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

I like the $ also very much, never use .s
Maybe for Rings, Fred can introduce the € euro sign Image
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

Berikco wrote:Maybe for Rings, Fred can introduce the € euro sign
Yeah, but for handling my bank account I would need 64bit Integers. ;-)
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Hmmm...

Post by LJ »

You can always give me your bank acct#. and access to your account and I'm sure I could find a 32bit work around solution. :wink:
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

I'm sure I could find a 32bit work around solution.
lol :lol:
--Kale

Image
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Post by TronDoc »

LOL :lol:
peace
[pI 166Mhz 32Mb w95]
[pII 350Mhz 256Mb atir3RagePro WinDoze '98 FE & 2k]
[Athlon 1.3Ghz 160Mb XPHome & RedHat9]
Post Reply