Long literals, with continuations: Difference between revisions
Long literals, with continuations (view source)
Revision as of 16:04, 17 December 2023
, 5 months ago→{{header|Wren}}: Changed to use a 'raw' string.
m (Correcting formatting error.) |
m (→{{header|Wren}}: Changed to use a 'raw' string.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 567:
const std::string UNNAMED_ELEMENTS = R"(
ununennium unquadnilium triunhexium penthextrium
penthexpentium septhexunium octenntrium ennennbium
)";
Line 1,022:
import java.util.Arrays;
import java.util.List;
public final class LongLiteralsWithContinuations {
Line 2,037 ⟶ 2,036:
=={{header|Wren}}==
{{libheader|Wren-pattern}}
We use a 'raw' string for this task.
▲<syntaxhighlight lang="ecmascript">import "/pattern" for Pattern
var elementStr =
var p = Pattern.new("+1/s") // matches 1 or more whitespace characters
var elements = p.splitAll(elementStr) // get a list of elements
elementStr = elements.join(" ") // recombine using a single space as separator
var lastUpdate = "
System.print("Last updated : %(lastUpdate)")
System.print("Number of elements : %(elements.count)")
Line 2,074 ⟶ 2,071:
{{out}}
<pre>
Last updated :
Number of elements : 118
Last element : oganesson
|