I wanted to split a string of length 200 characters and place them in the request DTO data member noteline1---noteline18. I want to make sure that only 78 characters are allowed and the remaining characters should be moved to another data member(if noteline1 is filled with 78 characters, then it should fill the remaining characters to another empty noteline). I have used the following code
if (requestNoteReason.Length < 78)
{
if (reqPropertyInfo.Name.ToLower() == null)
{
reqPropertyInfo.SetValue(request, requestNoteReason, null);
break;
}
}
else
{
reqPropertyInfo.SetValue(request, requestNoteReason.Substring(0, 78), null);
requestNoteReason = requestNoteReason.Substring(78, requestNoteReason.Length - 78);
i++;
continue;
}
The above code work fine but I want that it should not place the remaining string character on the non-empty noteline data member. It should first find the remaining empty Noteline(noteline1---noteline18) and then assign the remaining characters on them. How will I achieve it?