FIND YOUR NEXT FEW LINES

Results for “sub”

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

145 snippets foundClear filters
GoGetting Started

Calculate a subtotal

Calculate a subtotal using a complete Go program with explicit sample inputs.

Go✓ Tested
RustGetting Started

Calculate an order subtotal

Calculate an order subtotal in a complete Rust program using the standard library.

Rust✓ Tested
JavaScriptStrings

Check for a substring

Perform a case-sensitive JavaScript substring check.

JavaScript✓ Tested
ReactEffects & lifecycle

Clean up a subscription when a child unmounts

Clean up a subscription when a child unmounts with a small React component and explicit browser behavior.

React✓ Tested
PowerShellStrings & literal text

Extract a known substring

PowerShell: Substring uses a zero-based starting index and a character count.

PowerShell✓ Tested
Bash ScriptsParameter expansion

Extract a substring by offset and length

Bash Scripts: Bash substring offsets start at zero for an ordinary string.

Bash Scripts✓ Tested
C++Text validation & parsing

Extract a substring with an explicit count

C++: The second substr argument is a length rather than an ending index.

C++✓ Tested
C#Text validation & encoding

Extract a substring with range syntax

C#: C# range ends are exclusive; indices operate on UTF-16 code units.

C#✓ Tested
C++Strings

Find a substring

Check the result of std::string::find against npos.

C++✓ Tested
CStrings

Find a substring

Use strstr to find a literal substring in a C string.

C✓ Tested
AngularTemplate-driven forms

Handle a template-driven form submission

Handle a template-driven form submission with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
HTMLForm behavior

Identify the selected submit action

HTML: Each submit button can supply its own named value for the same form.

HTML✓ Tested