Solved

Maximum length of a string

Posted on 2006-07-11
5
465 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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