Good Morning / Afternoon / Evening fellow KNIMErs
A while ago I made a NuGet Package in C# that validates Strings and manipulates Strings. I wanted it to be a strict process so I used ASCII. Below is an example of one of the validation methods:
public static bool IsAllUKEULettersNumbersAndSpaces(string text)
{
int strLen = text.Length;
int counter = 0;
foreach (char c in text)
{
int currentChar = Convert.ToInt32(c);
// uppercase A - Z
if (currentChar > 64 && currentChar < 91) { counter += 1; }
// lowercase a - z
else if (currentChar > 96 && currentChar < 123) { counter += 1; }
// space
else if (currentChar == 32) { counter += 1; }
// numbers 0 - 9
else if (currentChar > 47 && currentChar < 58) { counter += 1; }
// Ă - Ă
else if (currentChar > 191 && currentChar < 215) { counter += 1; }
// Ă - Ăś
else if (currentChar > 215 && currentChar < 247) { counter += 1; }
// ø - ÿ
else if (currentChar > 247 && currentChar < 256) { counter += 1; }
}
if (strLen == counter)
{
return true;
}
else
{
return false;
}
}
I am now making a generic StringCleaner Component for my co-workers and I. It will be configurable with options like:
-
Chose Output Case: All Upper Case, All Lower Case, Pascal Case, Case as Input
-
Chose Output: Output as Input, Keep All UKEULetters Numbers and Spaces, Keep All UKEULetters and Spaces, Keep All Numbers and Spaces, Keep All UKEULetters and Numbers, etc
-
Remove Concurrent Spaces: false, true
-
And many more
I have looked at String Manipulation, String Replacer, Column Expression nodes etc and through the forums and can not find a way to use ASCII. I know I could put all of this in a Java Snippet.
Is there a KNIME solution out there?
Frank