FIND YOUR NEXT FEW LINES

Results for “prefix”

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

46 snippets foundClear filters
TypeScriptGetting Started

Combine text with a name

TypeScript: Construct a greeting from a fixed prefix and a stored name.

TypeScript✓ Tested
C++Getting Started

Combine text with a name

C++: Construct a greeting from a fixed prefix and a stored name.

C++✓ Tested
CGetting Started

Combine text with a name

C: Construct a greeting from a fixed prefix and a stored name.

C✓ Tested
Bash ScriptsParameter expansion

Extract a basename without an external process

Bash Scripts: Double hash removes the longest matching prefix ending in a slash.

Bash Scripts✓ Tested
JavaScriptText handling & Unicode

Extract the text after the last delimiter

JavaScript: Use lastIndexOf when earlier occurrences should remain part of the prefix.

JavaScript✓ Tested
TypeScriptText handling & Unicode

Extract the text after the last delimiter

TypeScript: Use lastIndexOf when earlier occurrences should remain part of the prefix.

TypeScript✓ Tested
Bash ScriptsText parsing & arithmetic

Parse digits with leading zeroes as decimal

Bash Scripts: The 10# prefix avoids Bash treating a leading zero as an octal notation.

Bash Scripts✓ Tested
PythonNumbers & calculations

Select the largest values without sorting everything

Python: Use heapq.nlargest when only a small prefix of the ranking is required.

Python✓ Tested
Bash ScriptsProcesses & environment

Set an environment value for one child command

Bash Scripts: A command-prefix assignment is visible to that command without overwriting the shell’s current variable.

Bash Scripts✓ Tested
PythonIteration & sequences

Take a limited number of iterator values

Python: Use islice to consume only the requested prefix of a potentially unbounded iterator.

Python✓ Tested