FIND YOUR NEXT FEW LINES

Results for “meter”

Small, practical examples. Search by task or narrow things down below.

48 snippets foundClear filters
Bash ScriptsVariables & text

Use a default value for an unset variable

Supply a fallback without changing the original variable.

parameter expansion✓ Tested
Bash ScriptsParameter expansion

Use an alternate value only when a variable is nonempty

Bash Scripts: The colon-plus expansion returns its word only when the parameter has a nonempty value.

Bash Scripts✓ Tested
PythonText validation & encoding

Build a URL query string

Python: Use urlencode to percent-encode query parameter values correctly.

Python✓ Tested
JavaScriptRegular expressions & URL encoding

Build a URL query string from values

JavaScript: URLSearchParams handles query escaping and repeated parameter appends.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Build a URL query string from values

TypeScript: URLSearchParams handles query escaping and repeated parameter appends.

TypeScript✓ Tested
Bash ScriptsArguments & decisions

Consume positional arguments one at a time

Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.

Bash Scripts✓ Tested
C#Types & reliable control flow

Pass behavior as a function delegate

C#: Func describes a callable with typed parameters and a return value.

C#✓ Tested
JavaScriptRegular expressions & URL encoding

Percent-encode one URL component

JavaScript: encodeURIComponent escapes a parameter value rather than a complete URL.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Percent-encode one URL component

TypeScript: encodeURIComponent escapes a parameter value rather than a complete URL.

TypeScript✓ Tested
Bash ScriptsVariables & text

Replace every occurrence in a string

Substitute text directly with Bash parameter expansion.

replace✓ Tested
Bash ScriptsInput streams & redirection

Substitute values into a multiline template

Bash Scripts: An unquoted heredoc delimiter enables parameter expansion in the template.

Bash Scripts✓ Tested
Bash ScriptsInput streams & redirection

Write a literal multiline block

Bash Scripts: Quoting the heredoc delimiter disables parameter and command expansion inside it.

Bash Scripts✓ Tested