You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2024/01/18 12:17:06 UTC
(causeway) branch master updated: CAUSEWAY-3404: adds (simple) double-quoting operator
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/master by this push:
new 9fafcc8b3f CAUSEWAY-3404: adds (simple) double-quoting operator
9fafcc8b3f is described below
commit 9fafcc8b3ff3863434520851f4386709ec250b58
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Jan 18 13:17:01 2024 +0100
CAUSEWAY-3404: adds (simple) double-quoting operator
- to internal string utils
---
.../java/org/apache/causeway/commons/internal/base/_Strings.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java
index 08dac54f82..bf6b8fc2eb 100644
--- a/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java
+++ b/commons/src/main/java/org/apache/causeway/commons/internal/base/_Strings.java
@@ -828,6 +828,12 @@ public final class _Strings {
public static final StringOperator asLowerCase = _Strings::lower;
+ /**
+ * Converts given literal into a double-quoted literal, unless the literal is {@code null},
+ * in which case {@code ""} is returned.
+ */
+ public static final StringOperator asDoubleQuoted = s->s!=null ? "\"" + s + "\"" : "\"\"";
+
public static final StringOperator asLowerDashed = asLowerCase
.compose(s->_Strings.condenseWhitespaces(s, "-"));