Package org.openrewrite.yaml.internal
Class StringUtils
java.lang.Object
org.openrewrite.yaml.internal.StringUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringquoteIfNeeded(String value) Quotes a YAML scalar value if needed, per the YAML 1.2.2 spec.
-
Method Details
-
quoteIfNeeded
Quotes a YAML scalar value if needed, per the YAML 1.2.2 spec.If the input is already quoted (surrounded by matching single or double quotes), it is returned as-is. Otherwise, the method determines whether the value requires quoting and applies the minimal quoting style: single quotes by default, double quotes only when escape sequences are required.
- Parameters:
value- the raw string value- Returns:
- the value, potentially quoted for safe use as a YAML scalar
-