Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Long Substring function

I have a string that "may" be longer than any simple int boundaries.

Currently, the string.substring function takes only int parameters as index and length which is not enough for me since i need long for the parameter value types.

Do you know any implementation of long substring function?

Or what do you recommend I do to solve this possible finding substring problem with very long string?

Thank you.

like image 941
Gloomdo Avatar asked Mar 12 '11 12:03

Gloomdo


1 Answers

I have a string that "may" be longer than any simple int boundaries.

No, in .NET you won't have that problem. The System.String class itself uses Int32 indexing and Length properties everywhere.

Maybe you will have a (char) array that's over 2GB but that is taken care of, you can use 'long` indexing.

Related question: What is the maximum possible length of a .NET string?

like image 122
Henk Holterman Avatar answered Nov 18 '22 15:11

Henk Holterman