FIND YOUR NEXT FEW LINES

Results for “Iteration & sequences”

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

52 snippets foundClear filters
JavaScriptRegular expressions & URL encoding

Decode a percent-encoded URL component

JavaScript: decodeURIComponent reverses percent encoding and throws for malformed sequences.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Decode a percent-encoded URL component

TypeScript: decodeURIComponent reverses percent encoding and throws for malformed sequences.

TypeScript✓ Tested
C#LINQ transformations

Flatten nested collections with SelectMany

C#: Concatenate the items from several sequences into one sequence.

C#✓ Tested
C++Filesystem operations

List regular files recursively in sorted order

C++: Collect relative paths before sorting because directory iteration order is unspecified.

C++✓ Tested
C#Text validation & encoding

Normalize canonically equivalent Unicode strings

C#: Normalize to NFC before an ordinal comparison of equivalent character sequences.

C#✓ Tested
JavaQueues & collection operations

Preserve map insertion order

Java: Use LinkedHashMap when iteration should follow the order keys were first added.

Java✓ Tested
Linux CommandsSearching text

Print only the matching portions

Linux Commands: Use extended regex and -o to extract digit sequences.

Linux Commands✓ Tested
PythonGetting Started

Repeat while a condition holds

Python: Count down while a positive number remains, updating the loop variable on each iteration.

Python✓ Tested
C#Getting Started

Repeat while a condition holds

C#: Count down while a positive number remains, updating the loop variable on each iteration.

C#✓ Tested
JavaGetting Started

Repeat while a condition holds

Java: Count down while a positive number remains, updating the loop variable on each iteration.

Java✓ Tested
JavaScriptGetting Started

Repeat while a condition holds

JavaScript: Count down while a positive number remains, updating the loop variable on each iteration.

JavaScript✓ Tested
TypeScriptGetting Started

Repeat while a condition holds

TypeScript: Count down while a positive number remains, updating the loop variable on each iteration.

TypeScript✓ Tested