Results for “substring”
Small, practical examples. Search by task or narrow things down below.
Check for a substring
Perform a case-sensitive JavaScript substring check.
JavaScript✓ Tested
Extract a known substring
PowerShell: Substring uses a zero-based starting index and a character count.
PowerShell✓ Tested
Extract a substring by offset and length
Bash Scripts: Bash substring offsets start at zero for an ordinary string.
Bash Scripts✓ Tested
Extract a substring with an explicit count
C++: The second substr argument is a length rather than an ending index.
C++✓ Tested
Extract a substring with range syntax
C#: C# range ends are exclusive; indices operate on UTF-16 code units.
C#✓ Tested
Find a substring
Check the result of std::string::find against npos.
C++✓ Tested
Find a substring
Use strstr to find a literal substring in a C string.
C✓ Tested
Inspect a substring without allocating a copy
C++: A string_view refers to existing storage and must not outlive that storage.
C++✓ Tested
Replace a literal substring
SQL: REPLACE performs a literal replacement rather than a regular-expression substitution.
SQL✓ Tested
Replace a literal substring
SQL Server: REPLACE performs a literal replacement rather than a regular-expression substitution.
SQL Server✓ Tested
Replace a literal substring
Postgres: REPLACE performs a literal replacement rather than a regular-expression substitution.
Postgres✓ Tested
Replace a literal substring
SQLite: REPLACE performs a literal replacement rather than a regular-expression substitution.
SQLite✓ Tested