VBdotnet2005
asked on
string - fixed lenght
I want to write to a file that each line contain up to 44 charactors and add a number to each line? The max of string is 2058.
Mystring = This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test This is a test This is a test - line 1
This is a test This is a test This is a test - line 2
This is a test This is a test This is a test - line 3
etc
dim mystring as string = mystring above
dim arr as new list(of string)
dim sr as new streamwriter(myfile)
For z as interger = 0 to mystring.lengh - 1 step 44
while mystring.lenght < 2048
arr.add ??? line # 1
sr.write(mystring(up to 44) and line number
end while
next
Mystring = This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
This is a test This is a test This is a test - line 1
This is a test This is a test This is a test - line 2
This is a test This is a test This is a test - line 3
etc
dim mystring as string = mystring above
dim arr as new list(of string)
dim sr as new streamwriter(myfile)
For z as interger = 0 to mystring.lengh - 1 step 44
while mystring.lenght < 2048
arr.add ??? line # 1
sr.write(mystring(up to 44) and line number
end while
next
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Open in new window