I am trying to split a string into lines of same length. I want to split the string by counting the number of characters. If the count is 50 then whole rest of the string goes to next line. Again start counting from the beginning of second line, once reached count of 50, move rest of the string to next line and same count starts with 3rd line and so on.
For example: If I have a text file with below format
Expected output:
For example: If I have a text file with below format
Code: Select all
hfcyfycfcucjccmnckhc cvshcvhfcyfycfcucjccmnckhc cvshcvm c cwujgvuewgvhiwdhvidwv vdwgvuwgdvjdbjvv hciehvidhvihdkv vihdihvidhvihviv
sbyds gvdy gvudsgvudgvjdbvjvd hgvudvjdbuvugdugvbdjsbcjsdbvgviebvjvbjdgvuegvbvjbvjvbuegvuvbjdbcweguevhvb wjvuegvvh vnbieojejgvhcvjbchevgevuvbev
Code: Select all
hfcyfycfcucjccmnckhc cvshcv
hfcyfycfcucjccmnckhc cvshcv
m c cwujgvuewgvhiwdhvidwv
vdwgvuwgdvjdbjvv hciehvidh