Results for “literal”
Small, practical examples. Search by task or narrow things down below.
Join several strings with a separator
PowerShell: The join operator returns one string from an input collection.
PowerShell✓ Tested
Pad a label with leading zeroes
PowerShell: Use a numeric format specifier to control the displayed width.
PowerShell✓ Tested
Prevent a variable value from expanding as a filename pattern
Bash Scripts: Quote a variable to pass its literal contents even when matching filenames exist.
Bash Scripts✓ Tested
Prevent expansion with single quotes
Linux Commands: Prevent expansion with single quotes using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Split text on a simple delimiter
PowerShell: The split operator uses a regular expression; this delimiter has no special regex meaning.
PowerShell✓ Tested
Trim whitespace around a string
PowerShell: The Trim method removes surrounding whitespace while preserving the middle of the string.
PowerShell✓ Tested
Write a multiline string without expanding variables
PowerShell: A single-quoted here-string preserves dollar signs literally.
PowerShell✓ Tested
Add an interval to a date
Perform calendar arithmetic with an interval literal.
INTERVAL✓ Tested
Allocate and initialize a structure
C: Use a compound literal assignment to initialize all ordinary structure fields.
C✓ Tested
Check a filename suffix
Java: Use endsWith for a case-sensitive literal suffix test.
Java✓ Tested
Check a string prefix
Java: Use startsWith to check a literal Java prefix without a regular expression.
Java✓ Tested
Check exact array membership
Bash Scripts: Compare each element literally instead of searching a concatenated string.
Bash Scripts✓ Tested