Split string depending upon character count

Hi,

I am having a text file paragraph in which each line should store 64 characters and If the
64th Character lies in middle of the word, we have to carry forward that word to next line.
And the data needs to be stored into excel

Please help me, Thanks in advance.

Thanks & regards,
Lakshmi

Hi @lakshmi.mp,

You have a 100 character variable. You want to use the first 64 words and take the rest from there and add them to another field, is it true?

If so you can use bellow.

for the first 64 — yourValue.Substring(0,64).ToString
for after 64 — yourValue.Substring(64).ToString

Regards,
MY

Hi,

readData.txt (3.9 KB)
I have attached text file where it has so many characters my code working only for first 64 characters and not working for rest of the characters.

Thanks,
Lakshmi

Hi,

The following topic might help you.

Regards,

Hi Yoichi,

This one i tried out but its working only for 1 line of data from text file not working for rest of the lines.

Regards,
Lakshmi
readData.txt (3.9 KB)

Hi,

How about the following sample?

Sample20220525-5.zip (4.9 KB)

Regards,

Hi Yoichi,

Its working now, thanks a lot for helping.

Thanks & Regards,
Lakshmi

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.