Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void DivideIndex(List<string> inputString, int index, int partitionsToDivide)
- {
- string positionName = inputString[index];
- int partitionSize = positionName.Length / partitionsToDivide;
- string[] positionNameArray = new string[partitionsToDivide];
- inputString.RemoveAt(index);
- int counterTest = 0;
- for (int i = 0; i < partitionsToDivide; i++)
- {
- string test = string.Empty;
- if (i != partitionsToDivide -1)
- {
- test = positionName.Substring(counterTest, partitionSize);
- }
- else
- {
- test = positionName.Substring(counterTest, partitionSize + positionName.Length % partitionsToDivide);
- }
- inputString.Insert(index +i,test);
- counterTest += partitionSize;
- }
- //int posiitionNameArrayIndex = 0;
- //int counterCheck = 0;
- //for (int i = 0; i < positionName.Length; i++)
- //{
- // positionNameArray[posiitionNameArrayIndex] += positionName[i].ToString();
- // counterCheck++;
- // if (counterCheck == partitionSize && posiitionNameArrayIndex !=partitionsToDivide -1)
- // {
- // posiitionNameArrayIndex++;
- // counterCheck = 0;
- // }
- //}
- //inputString.RemoveAt(index);
- //for (int j = partitionsToDivide -1; j >= 0; j--)
- //{
- // inputString.Insert(index, positionNameArray[j]);
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement