Fixed an issue with a character being dropped in GetStringLines()
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
f3bf997652
commit
442a967cd9
@ -896,11 +896,12 @@ namespace Assignment_1
|
|||||||
static List<string> GetStringLines(string source, int maxWidth)
|
static List<string> GetStringLines(string source, int maxWidth)
|
||||||
{
|
{
|
||||||
List<string> lines = new();
|
List<string> lines = new();
|
||||||
for (int i = 0; i < source.Length; i++)
|
int j = 0;
|
||||||
|
while (j < source.Length)
|
||||||
{
|
{
|
||||||
int max = i + maxWidth <= source.Length ? i + maxWidth : source.Length;
|
int max = j + maxWidth <= source.Length ? j + maxWidth : source.Length;
|
||||||
lines.Add(source[i..max]);
|
lines.Add(source[j..max]);
|
||||||
i = max;
|
j = max;
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user