reading a string for predefined size

  • Thread starter Thread starter sony.m.2007
  • Start date Start date
S

sony.m.2007

Hi,
I have a large string and i need to split the string into 5
characters.
for example
string st="test1234567890test1234567dfghhhjrt57ujkk8"
I want to split the above string st into strings of 5 characters.
if the string length is 33 means, the output string count is 7.
6 string contains 5 characters and 7th one will contain 3 only.
Is there string function available to do this?

Thanks,
Sony
 
Hi,
I have a large string and i need to split the string into 5
characters.
for example
string st="test1234567890test1234567dfghhhjrt57ujkk8"
I want to split the above string st into strings of 5 characters.
if the string length is 33 means, the output string count is 7.
6 string contains 5 characters and 7th one will contain 3 only.
Is there string function available to do this?

It looks like some homework to do. Isn't it ?
 
Hi,
I have a large string and i need to split the string into  5
characters.
for example
string st="test1234567890test1234567dfghhhjrt57ujkk8"
I want to split the above string st into strings of 5 characters.
if the string length is 33 means, the output string count is 7.
6 string contains 5 characters and 7th one will contain 3 only.
Is there string function available to do this?

It looks like some homework to do. Isn't it ?[/QUOTE]

Hi,

I already completed the splitting with substring function.
I would like to know is there any other easiest function available

Thanks,
Sony
 
Hi,
I have a large string and i need to split the string into 5
characters.
for example
string st="test1234567890test1234567dfghhhjrt57ujkk8"
I want to split the above string st into strings of 5 characters.
if the string length is 33 means, the output string count is 7.
6 string contains 5 characters and 7th one will contain 3 only.
Is there string function available to do this?

Thanks,
Sony

There's a one-liner for everything. ;)

string[] x = (from Match m in Regex.Matches(st, @"[\W\w]{1,5}") select
m.Value).ToArray();
 
Hi,
I have a large string and i need to split the string into  5
characters.
for example
string st="test1234567890test1234567dfghhhjrt57ujkk8"
I want to split the above string st into strings of 5 characters.
if the string length is 33 means, the output string count is 7.
6 string contains 5 characters and 7th one will contain 3 only.
Is there string function available to do this?
Thanks,
Sony

There's a one-liner for everything. ;)

string[] x = (from Match m in Regex.Matches(st, @"[\W\w]{1,5}") select
m.Value).ToArray();

Hi,
Great.
That's the simple way I want.
Thank a lot

Cheers,
Sony
 
Back
Top