Results for “Strings & text”
Small, practical examples. Search by task or narrow things down below.
Split a line into named fields
Read a simple delimiter-separated line into variables.
read✓ Tested
Style content associated with a checked option
CSS: The adjacent-sibling selector connects a checked control with its following label text.
CSS✓ Tested
Style list markers
Set marker color separately from list text using CSS ::marker.
CSS✓ Tested
Sum the decimal digits of an unsigned integer
C: Repeated division and remainder extract digits without converting to text.
C✓ Tested
Test whether an array contains a value
PowerShell: The contains operator compares complete items rather than matching substrings.
PowerShell✓ Tested
Trim surrounding whitespace
Remove whitespace at the ends of a C# string.
C#✓ Tested
Trim surrounding whitespace
Remove leading and trailing whitespace from a Java string.
Java✓ Tested
Trim surrounding whitespace
Remove leading and trailing JavaScript string whitespace.
JavaScript✓ Tested
Try parsing an integer
Use TryParse to avoid exceptions for invalid C# integer input.
C#✓ Tested
Update a JSON property
Create updated JSON text with JSON_MODIFY.
JSON_MODIFY✓ Tested
Use a default value for an unset variable
Supply a fallback without changing the original variable.
parameter expansion✓ Tested
Validate a finite numeric value without coercion
JavaScript: Number.isFinite rejects numeric strings as well as NaN and infinity.
JavaScript✓ Tested