From 657c1a3fdc049e8d9722d913289e66bc87439c88 Mon Sep 17 00:00:00 2001 From: Julien Kronegg Date: Thu, 5 Jan 2023 07:58:00 +0100 Subject: [PATCH] Update StringUtils.java Added description to methods that do non-evident operations. --- .../src/main/java/io/cucumber/gherkin/StringUtils.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/src/main/java/io/cucumber/gherkin/StringUtils.java b/java/src/main/java/io/cucumber/gherkin/StringUtils.java index 5753eedaf..a33c6b781 100644 --- a/java/src/main/java/io/cucumber/gherkin/StringUtils.java +++ b/java/src/main/java/io/cucumber/gherkin/StringUtils.java @@ -15,11 +15,21 @@ static String ltrim(String s) { return LTRIM.matcher(s).replaceAll(""); } + /** + * Trims whitespace on the left-hand side up to the first + * non-whitespace character and exclude new lines from the + * usual definition of whitespace. + */ static String ltrimKeepNewLines(String s) { // https://stackoverflow.com/questions/1060570/why-is-non-breaking-space-not-a-whitespace-character-in-java return LTRIM_KEEP_NEW_LINES.matcher(s).replaceAll(""); } + /** + * Trims whitespace on the right-hand side up to the first + * non-whitespace character and exclude new lines from the + * usual definition of whitespace. + */ static String rtrimKeepNewLines(String s) { // https://stackoverflow.com/questions/1060570/why-is-non-breaking-space-not-a-whitespace-character-in-java return RTRIM_KEEP_NEW_LINES.matcher(s).replaceAll("");