|
-
Jun 13th, 2000, 01:29 PM
#1
Thread Starter
Addicted Member
I Was wondering..what is a better way to declare a string?
Use a "M$" (for example) Or Is it better to use the
Dim M As String?
Thanks
-
Jun 13th, 2000, 01:40 PM
#2
Fanatic Member
Up to your preference!
I like to Dim it better, but I heard that using Left$ will run much faster than Left.
Chemically Formulated As:
Dr. Nitro
-
Jun 13th, 2000, 02:50 PM
#3
Guru
Some clarifications I would like to point out 
Never use
Dim M$
always use
Dim M as string
those symbols are just there for backward compatibility, it is much more readable and maintainable to explictly declare the variable type.
If a future programmer wants to maintain this code, they will have a tough time because they might have never had to write VB 3 code, so these symbols will be meaningless to them....
based on my own benchmarks, the LEFT$ runs less than .1% faster than LEFT
-
Jun 13th, 2000, 03:57 PM
#4
transcendental analytic
I don't thinks so, i'm using the !@#$%& more than ever because they take so little space and I think it's easier to read too, ie when you declare a function you will have the return type directly after the function name, and all arguments are easier to overview if they aren't spread out with as string and as integer and things.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 13th, 2000, 04:29 PM
#5
Frenzied Member
Clunietp gets my vote!
Sorry kedaman but I agree with Clunietp in this one!
-
Jun 13th, 2000, 08:57 PM
#6
I agree that for declaring variables, you should always use the "As datatype" clause. The special symbols are still in the language for backwards compatibility.
However, for functions that return string values (such as Left, Mid, Trim, Format, etc.), I believe it is preferable to use the $ at the end. Without the $, these functions return a Variant data type rather than a string, so extra conversion steps are necessary.
"It's cold gin time again ..."
Check out my website here.
-
Jun 14th, 2000, 02:41 AM
#7
I too agree with Clunietp. M$, MyString$, Myint@ etc. all looks kind of like jargon when you look at the whole picture.
-
Jun 19th, 2000, 06:44 AM
#8
transcendental analytic
Hmmm, Backward compability or not, it doesn't matter, I still have a very comprimized style and I'm sorry if other's have to use my code and don't like the special characters, if anyone could make a addin so you can change between using as vartype and special chars, I would be happy
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 19th, 2000, 06:52 AM
#9
I never said that I didn't like them. I just think that you're making it look like jargon when you don't have to.
-
Jun 19th, 2000, 07:45 AM
#10
transcendental analytic
For me, it's the other way round
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|