Solved

Maximum length of a string

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now