Class Normalizer
java.lang.Object
me.nickhanson.codeforge.evaluator.Normalizer
Utility class for normalizing strings for evaluation.
Provides methods to standardize strings by trimming whitespace,
converting to lowercase, collapsing multiple spaces, and stripping punctuation.
- Author:
- Nick Hanson
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringPerforms basic normalization on the input string: - Trims leading and trailing whitespace - Converts to lowercase - Collapses multiple whitespace characters into a single spacestatic StringCollapses multiple consecutive whitespace characters into a single space.static StringStrips all punctuation characters from the input string.
-
Method Details
-
basic
Performs basic normalization on the input string: - Trims leading and trailing whitespace - Converts to lowercase - Collapses multiple whitespace characters into a single space- Parameters:
s- The input string to normalize- Returns:
- The normalized string
-
collapseWhitespace
Collapses multiple consecutive whitespace characters into a single space.- Parameters:
s- The input string- Returns:
- The string with collapsed whitespace
-
stripPunctuation
Strips all punctuation characters from the input string.- Parameters:
s- The input string- Returns:
- The string without punctuation
-