|
-
Oct 7th, 2000, 02:49 PM
#1
Thread Starter
Hyperactive Member
I know that a string varaible has a limit in size (I think it is 256 characters - please correct me if I am wrong) is there any way to use a string which is biggrer than that inside a variable ?
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Oct 7th, 2000, 02:52 PM
#2
Fanatic Member
I think the size limit of a string is 2gb...
-
Oct 8th, 2000, 07:52 AM
#3
How come nobody ever reads the Help-files before asking a question here?
Type in something like Dim Q as String, put your cursor on the "String" keyword and hit F1. The select "String Data Type". This is what the helpfiles will tel you:
There are two kinds of strings: variable-length and fixed-length strings.
A variable-length string can contain up to approximately 2 billion (2^31) characters.
A fixed-length string can contain 1 to approximately 64K (2^16) characters.
Note APublic fixed-length string can't be used in a class module.
The codes for String characters range from 0–255. The first 128 characters (0–127) of the character set correspond to the letters and symbols on a standard U.S. keyboard. These first 128 characters are the same as those defined by theASCII character set. The second 128 characters (128–255) represent special characters, such as letters in international alphabets, accents, currency symbols, and fractions. The type-declaration character for String is the dollar sign ($).
-
Oct 8th, 2000, 08:02 AM
#4
Frenzied Member
How do you declare fixed-length strings?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 8th, 2000, 08:19 AM
#5
Code:
Dim FLString as String * 25
To make it more clear try this code:
Code:
Dim FLString As String * 25
FLString = "Hello"
' Watch out! The Len(FLString) is STILL 25!!
Debug.Print "[" & FLString & "]"
Debug.Print "[" & Trim(FLString) & "]"
FLString = "Hello this line is a very long one!!!"
' The Len(FL String) is now STILL 25!!
Debug.Print "[" & FLString & "]"
Debug.Print "[" & Trim(FLString) & "]"
Enjoy!
-
Oct 8th, 2000, 08:25 AM
#6
Frenzied Member
Thanks, that cleared things up.
So Fixed Length string take up less resources huh?
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Oct 8th, 2000, 10:09 AM
#7
No, a "Dynamic" string will be more resource friendly if you asked me. I think a Dynamic string is just a pointer to a memory location. If the size overgrows the previous size then some extra memory will be allocated. A fixed length string always takes up the number of chars that fit + another byte or 2 maybe even 4) for pointer data etc...
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
|