FIND YOUR NEXT FEW LINES

Results for “substring”

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

26 snippets foundClear filters
RustStrings & Unicode

Replace a literal substring

Replace a literal substring in a complete Rust program using the standard library.

Rust✓ Tested
Arduino / CText & bounded buffers

Extract a section of an Arduino String

Arduino / C: substring includes the start index and excludes the end index.

Arduino / C✓ Tested
SQLiteQueries & text

Extract part of a string

Use one-based positions with substr.

substr✓ Tested
JavaText validation & formatting

Extract text between known positions

Java: Java substring uses a start-inclusive, end-exclusive range of UTF-16 indices.

Java✓ Tested
Bash ScriptsGetting Started

Read part of a shell string

Bash Scripts: Read part of a shell string with a small standalone Bash program.

Bash Scripts✓ Tested
PythonStrings & dates

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
JavaStrings

Check whether text contains a phrase

Use a case-sensitive Java substring check.

Java✓ Tested
C#Strings

Find text ignoring case

Use ordinal case-insensitive comparison for a C# substring search.

C#✓ Tested
Linux CommandsSearching text

Match a whole word

Linux Commands: Use grep -w to exclude a matching substring inside a longer word.

Linux Commands✓ Tested
JavaScriptStrings

Replace all literal matches

Replace repeated substrings with JavaScript replaceAll.

JavaScript✓ Tested
Linux CommandsText processing

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
C++Strings

Replace the first match

Find and replace one literal substring in C++.

C++✓ Tested