Results for “Pipes & formatting”
Small, practical examples. Search by task or narrow things down below.
Count Unicode code points
Java: Use codePointCount when supplementary characters should count as one rather than two UTF-16 units.
Java✓ Tested
Extract successive regex matches
Java: Use a Matcher loop to find all unsigned integer tokens in Java text.
Java✓ Tested
Extract text between known positions
Java: Java substring uses a start-inclusive, end-exclusive range of UTF-16 indices.
Java✓ Tested
Process the lines of an in-memory string
Java: Use String.lines to handle common line terminators without retaining them.
Java✓ Tested
Repeat text a fixed number of times
Java: Use String.repeat with a nonnegative repetition count.
Java✓ Tested
Treat dynamic regex input as literal text
Java: Use Pattern.quote so metacharacters in a search term lose their special meaning.
Java✓ Tested
Validate a complete identifier
Java: String.matches requires the regular expression to match the entire input.
Java✓ Tested
Accept either of two conditions
SQL: Use OR to keep matching names or out-of-stock rows.
SQL✓ Tested
Accept either of two conditions
SQL Server: Use OR to keep matching names or out-of-stock rows.
SQL Server✓ Tested
Accept either of two conditions
Postgres: Use OR to keep matching names or out-of-stock rows.
Postgres✓ Tested
Accept either of two conditions
SQLite: Use OR to keep matching names or out-of-stock rows.
SQLite✓ Tested
Add an interval to a date
Perform calendar arithmetic with an interval literal.
INTERVAL✓ Tested