Results for “substr”
Small, practical examples. Search by task or narrow things down below.
Replace a literal substring
Replace a literal substring in a complete Rust program using the standard library.
Rust✓ Tested
Extract a section of an Arduino String
Arduino / C: substring includes the start index and excludes the end index.
Arduino / C✓ Tested
Extract part of a string
Use one-based positions with substr.
substr✓ Tested
Extract text between known positions
Java: Java substring uses a start-inclusive, end-exclusive range of UTF-16 indices.
Java✓ Tested
Read part of a shell string
Bash Scripts: Read part of a shell string with a small standalone Bash program.
Bash Scripts✓ Tested
Replace text in a string
Replace every occurrence of a substring and keep the result in a new string. The original string is unchanged.
string✓ Tested
Check whether text contains a phrase
Use a case-sensitive Java substring check.
Java✓ Tested
Find text ignoring case
Use ordinal case-insensitive comparison for a C# substring search.
C#✓ Tested
Match a whole word
Linux Commands: Use grep -w to exclude a matching substring inside a longer word.
Linux Commands✓ Tested
Replace all literal matches
Replace repeated substrings with JavaScript replaceAll.
JavaScript✓ Tested
Replace text with sed
Replace all occurrences of the substring old on each line and print the transformed text without changing the input file.
sed✓ Tested
Replace the first match
Find and replace one literal substring in C++.
C++✓ Tested