Solved

Maximum length of a string

Posted on 2006-07-11
5
463 Views
Last Modified: 2010-04-23
What is the maximum length of a string.  I am trying to store a document in a variable and my plan was to use a string, but I don't know what the maximum length is.  If there is one, is there a better way to store a 500 word document in a variable?

0
Comment
Question by:johnywhite
5 Comments
 
LVL 18

Assisted Solution

by:Ravi Singh
Ravi Singh earned 150 total points
ID: 17086820
Maximum length of string is 2147483648 unicode characters.

See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vadatString.asp
0
 
LVL 5

Assisted Solution

by:nickhoggard
nickhoggard earned 150 total points
ID: 17086836
Hi,

I can't say that I have ever come across a problem with a string getting too long, but I did find the following article that indicates that the max length is something approaching UInt32.Max.
http://www.codeproject.com/dotnet/strings.asp

If you document is only 500 words then it should be well within the realms of being stored within a String variable.

Cheers

Nick
0
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 200 total points
ID: 17086896
You may find that (depending on version) your string limit is actually closer to 32K. At least, this is the maximum you can display in a text box... so I'd take that as the practical limit if UI is involved.
0
 

Author Comment

by:johnywhite
ID: 17087096
Thanks, that is what I was looking for.
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 17087106
Glad to help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question