Marked as 'AdvertsingProfitControl 0.9.5.2' by its folder. I believe this version is where most of the main interface for the user was complete and I was toying with the idea of allowing the user to change the shrink on the main form.
This commit is contained in:
@@ -28,7 +28,6 @@ namespace AdvertsingProfitControl
|
||||
var isPreviousCharWhiteSpace = false;
|
||||
var cleanedInputString = "";
|
||||
var lastnumberStartingIndex = -1;
|
||||
var removedCharacterOffset = 0;
|
||||
//Create an array of brackets to test for, and either balance out or simply ignore the extras.
|
||||
char[] openBrackets = { '(', '<', '{', '[' };
|
||||
char[] closedBrackets = { ')', '>', '}', ']' };
|
||||
@@ -47,7 +46,6 @@ namespace AdvertsingProfitControl
|
||||
if (isPreviousCharWhiteSpace)
|
||||
{
|
||||
//If more then one space is found to be in a row, then ignore it and move onto the next character.
|
||||
removedCharacterOffset++;
|
||||
continue;
|
||||
}
|
||||
//IF the current character is whitespace, then mark it and move onto the next loop.
|
||||
@@ -62,7 +60,6 @@ namespace AdvertsingProfitControl
|
||||
if (isInsideBrackets)
|
||||
{
|
||||
//If we are already inside of brackets then don't add anymore to the string just continue.
|
||||
removedCharacterOffset++;
|
||||
continue;
|
||||
}
|
||||
isInsideBrackets = true;
|
||||
@@ -76,7 +73,6 @@ namespace AdvertsingProfitControl
|
||||
//IF we're not inside brackets then there is an imbalance so discard this parenthesis.
|
||||
if (!isInsideBrackets)
|
||||
{
|
||||
removedCharacterOffset++;
|
||||
continue;
|
||||
}
|
||||
//Just gonna force parenthesis for now.
|
||||
@@ -85,19 +81,19 @@ namespace AdvertsingProfitControl
|
||||
//Clear the current working word.
|
||||
isInsideBrackets = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//IF the current character is not a number and the previous character is a white space character
|
||||
//then capitalize the current character and add it to the string.
|
||||
if (!char.IsNumber(adItemText[currentCharacter]) && isPreviousCharWhiteSpace)
|
||||
{
|
||||
//Check to see the length of the string and determine if the word with the number needs to be capitalized.
|
||||
if (char.IsNumber(cleanedInputString[currentCharacter - (2 + removedCharacterOffset)]))
|
||||
if (char.IsNumber(cleanedInputString[cleanedInputString.Length - 2]))
|
||||
{
|
||||
BuildAbbreviationsAndWordsLists(adItemText, currentCharacter, out abbreviations, out words);
|
||||
//Remove the last space if there are any abbreviations or words found.
|
||||
if (abbreviations.Count > 0 || words.Count > 0)
|
||||
{
|
||||
cleanedInputString = cleanedInputString.Remove(currentCharacter - (1 + removedCharacterOffset), 1);
|
||||
cleanedInputString = cleanedInputString.Remove(cleanedInputString.Length - 1, 1);
|
||||
}
|
||||
//Begin checking to see how to place these items back into the final string.
|
||||
if (abbreviations.Count >= 1 && words.Count == 0)
|
||||
@@ -143,7 +139,7 @@ namespace AdvertsingProfitControl
|
||||
else if (!char.IsNumber(adItemText[currentCharacter]) && char.IsLetter(adItemText[currentCharacter]))
|
||||
{
|
||||
//IF the previous character is a number...
|
||||
if (char.IsNumber(cleanedInputString[currentCharacter - (1 + removedCharacterOffset)]))
|
||||
if (char.IsNumber(cleanedInputString[cleanedInputString.Length - 1]))
|
||||
{
|
||||
//Check to see the length of the string and determine if the word with the number needs to be capitalized.
|
||||
BuildAbbreviationsAndWordsLists(adItemText, currentCharacter, out abbreviations, out words);
|
||||
@@ -183,7 +179,7 @@ namespace AdvertsingProfitControl
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (char.IsLetter(adItemText[currentCharacter - 1]))
|
||||
else if (char.IsLetter(adItemText[currentCharacter - 1]) || adItemText[currentCharacter - 1] == '\'')
|
||||
{
|
||||
cleanedInputString += char.ToLowerInvariant(adItemText[currentCharacter]);
|
||||
}
|
||||
@@ -191,10 +187,20 @@ namespace AdvertsingProfitControl
|
||||
//IF a number is found, and we're not inside brackets, check to see if there is an opening parenthesis and if there aren't create one.
|
||||
if (char.IsNumber(adItemText[currentCharacter]))
|
||||
{
|
||||
cleanedInputString += adItemText[currentCharacter];
|
||||
if (lastnumberStartingIndex == -1)
|
||||
{
|
||||
lastnumberStartingIndex = currentCharacter - removedCharacterOffset;
|
||||
lastnumberStartingIndex = cleanedInputString.Length - 1; //Non-index based system, minus one for the index
|
||||
}
|
||||
}
|
||||
//Check for any allowed punctuation.
|
||||
if (adItemText[currentCharacter] == '\'')
|
||||
{
|
||||
cleanedInputString += adItemText[currentCharacter];
|
||||
}
|
||||
//Check if the previous character is an "'".
|
||||
else if (cleanedInputString[cleanedInputString.Length - 1] == '\'')
|
||||
{
|
||||
cleanedInputString += adItemText[currentCharacter];
|
||||
}
|
||||
//Since whitespace booleans are handled above, set the boolean for white spaces false.
|
||||
@@ -205,6 +211,7 @@ namespace AdvertsingProfitControl
|
||||
{
|
||||
cleanedInputString += ')';
|
||||
}
|
||||
//removedCharacterOffset++;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
Reference in New Issue
Block a user