Solved

Maximum length of a string

Posted on 2006-07-11
5
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

635 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