FIND YOUR NEXT FEW LINES

Results for “Strings & Unicode”

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

112 snippets foundClear filters
C#Text validation & encoding

Build text incrementally with StringBuilder

C#: Append fragments instead of repeatedly concatenating intermediate strings in a loop.

C#✓ Tested
JavaScriptStrings

Check for a substring

Perform a case-sensitive JavaScript substring check.

JavaScript✓ Tested
JavaStrings

Check whether text contains a phrase

Use a case-sensitive Java substring check.

Java✓ Tested
Arduino / CText & bounded buffers

Compare a command case-sensitively

Arduino / C: strcmp returns zero when both null-terminated strings match.

Arduino / C✓ Tested
CStrings

Convert ASCII text to uppercase

Convert characters with toupper while avoiding signed-char undefined behavior.

C✓ Tested
CStrings

Copy text into a fixed buffer

Use snprintf and check for truncation when copying a C string.

C✓ Tested
Linux CommandsStreams & byte tools

Count bytes in a file

Linux Commands: Use wc -c for byte length rather than Unicode character count.

Linux Commands✓ Tested
PythonStrings & dates

Extract numbers from text

Find all runs of ASCII digits in a string and convert the matches to integers.

regex✓ 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
GitCommits & history

Find commits by message

Search commit subjects and bodies for a phrase.

log✓ Tested
C#Strings

Find text ignoring case

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

C#✓ Tested