Marked as 'AdvertsingProfitControl (New Add Form)' by its folder name. I think this was one of the first appearences of a modify record form, however I may have gotten the order mixed up here with the previous commit. Reguardless, this version still introduced the first appearence of a new 'Modify Record' form.
This commit is contained in:
@@ -27,13 +27,13 @@ namespace StringInputParseTester
|
||||
private void ExecuteParserCode(object sender, EventArgs e)
|
||||
{
|
||||
var adItemText = inputTextBox.Text.Trim();
|
||||
//var splitInput = inputTextBox.Text.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
|
||||
var isInsideBrackets = false;
|
||||
var isPreviousCharWhiteSpace = false;
|
||||
//preserveAcronyms
|
||||
var preserveAcronyms = true;
|
||||
var cleanedInputString = "";
|
||||
var lastnumberStartingIndex = -1;
|
||||
var removedCharacterOffset = 0;
|
||||
//Create an array of brackets to test for, and either balance out or simply ignore.
|
||||
char[] openBrackets = {'(', '<', '{', '['};
|
||||
char[] closedBrackets = {')', '>', '}', ']'};
|
||||
@@ -52,6 +52,7 @@ namespace StringInputParseTester
|
||||
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.
|
||||
@@ -65,6 +66,7 @@ namespace StringInputParseTester
|
||||
if (isInsideBrackets)
|
||||
{
|
||||
//If we are already inside of brackets then don't add anymore to the string just continue.
|
||||
removedCharacterOffset++;
|
||||
continue;
|
||||
}
|
||||
isInsideBrackets = true;
|
||||
@@ -78,6 +80,7 @@ namespace StringInputParseTester
|
||||
//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.
|
||||
@@ -92,7 +95,7 @@ namespace StringInputParseTester
|
||||
if (!char.IsNumber(adItemText[currentCharacter]) && isPreviousCharWhiteSpace)
|
||||
{
|
||||
//Check to see if the character before the whitespace is a number.
|
||||
if (char.IsNumber(cleanedInputString[cleanedInputString.Length - 2]))
|
||||
if (char.IsNumber(cleanedInputString[currentCharacter - (2 + removedCharacterOffset)]))
|
||||
{
|
||||
var abbreviations = new List<string>();
|
||||
var words = new List<string>();
|
||||
@@ -100,7 +103,7 @@ namespace StringInputParseTester
|
||||
//Remove the last space if there are any abbreviations or words found.
|
||||
if (abbreviations.Count > 0 || words.Count > 0)
|
||||
{
|
||||
cleanedInputString = cleanedInputString.Remove(cleanedInputString.Length - 1, 1);
|
||||
cleanedInputString = cleanedInputString.Remove(currentCharacter - (1 + removedCharacterOffset), 1);
|
||||
}
|
||||
//Begin checking to see how to place these items back into the final string.
|
||||
if (abbreviations.Count >= 1 && words.Count == 0)
|
||||
@@ -146,7 +149,7 @@ namespace StringInputParseTester
|
||||
else if (!char.IsNumber(adItemText[currentCharacter]) && char.IsLetter(adItemText[currentCharacter]))
|
||||
{
|
||||
//IF the previous character is a number...
|
||||
if (char.IsNumber(cleanedInputString[cleanedInputString.Length - 1]))
|
||||
if (char.IsNumber(cleanedInputString[currentCharacter - (1 + removedCharacterOffset)]))
|
||||
{
|
||||
//Check to see the length of the string and determine if the word with the number needs to be capitalized.
|
||||
var abbreviations = new List<string>();
|
||||
@@ -196,21 +199,10 @@ namespace StringInputParseTester
|
||||
//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 = cleanedInputString.Length - 1; //This is index based.
|
||||
lastnumberStartingIndex = currentCharacter - removedCharacterOffset;
|
||||
}
|
||||
}
|
||||
//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.
|
||||
@@ -232,23 +224,23 @@ namespace StringInputParseTester
|
||||
/// three (3) characters long or being exactly three characters long but having
|
||||
/// zero (0) vowels.
|
||||
/// </summary>
|
||||
/// <param name="text">The string to determine whether or not its a word.</param>
|
||||
/// <param name="stringToCheck">The string to determine whether or not its a word.</param>
|
||||
/// <returns></returns>
|
||||
private bool IsWord(string text)
|
||||
private bool IsWord(string stringToCheck)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return false;
|
||||
if (string.IsNullOrEmpty(stringToCheck)) return false;
|
||||
var isWord = true;
|
||||
//Most abbreviations do not have vowels in them so check to see if the "abbreviation"
|
||||
//isn't just a short word like "Box", as opposed to "lbs".
|
||||
char[] vowels = {'a', 'e', 'i', 'o', 'u', 'y'};
|
||||
//Count the number of vowels the word has.
|
||||
var vowelCount = text.Count(x => vowels.Contains(x));
|
||||
var vowelCount = stringToCheck.Count(x => vowels.Contains(x));
|
||||
//IF the string is exactly three (3) characters long and has more then zero (0) vowels then it is considered a word.
|
||||
if (text.Length == 3 && vowelCount == 0)
|
||||
if (stringToCheck.Length == 3 && vowelCount == 0)
|
||||
{
|
||||
isWord = false;
|
||||
}
|
||||
else if (text.Length < 3)
|
||||
else if (stringToCheck.Length < 3)
|
||||
{
|
||||
isWord = false;
|
||||
}
|
||||
@@ -315,25 +307,5 @@ namespace StringInputParseTester
|
||||
words[i] = CapitalizeFirstLetter(words[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public string FormatShit(string inputString)
|
||||
{
|
||||
var finalString = "";
|
||||
var workingText = "";
|
||||
//The (char[])null avoids creating a new object in memory.
|
||||
var splitInput = inputString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var text in splitInput)
|
||||
{
|
||||
//Clear the working text to start building the next one to test.
|
||||
workingText = "";
|
||||
foreach (var character in text)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return finalString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user