FIND YOUR NEXT FEW LINES

Results for “Strings & Unicode”

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

112 snippets foundClear filters
JavaRecords & reliable control flow

Represent a finite set of states

Java: Use an enum to prevent arbitrary strings from representing application states.

Java✓ Tested
C++Strings

Reverse a string

Reverse a byte string in place with std::reverse.

C++✓ Tested
PythonNumbers & calculations

Round decimal amounts explicitly

Python: Build Decimal values from strings and choose a rounding rule explicitly.

Python✓ Tested
PythonStrings & dates

Split a string into words

Split text on whitespace, automatically treating repeated spaces, tabs, and line breaks as a single separator.

string✓ Tested
JavaScriptStrings

Split and trim text

Split simple comma-separated JavaScript text and trim each part.

JavaScript✓ Tested
C#Strings

Split and trim values

Split simple comma-separated C# text and trim each value.

C#✓ Tested
JavaStrings

Split comma-separated text

Split a simple comma-separated string into individual Java values.

Java✓ Tested
C++Strings

Split comma-separated text

Use getline with a delimiter to split simple C++ text.

C++✓ Tested
PowerShellArray operations

Test whether an array contains a value

PowerShell: The contains operator compares complete items rather than matching substrings.

PowerShell✓ Tested
C#Strings

Trim surrounding whitespace

Remove whitespace at the ends of a C# string.

C#✓ Tested
JavaStrings

Trim surrounding whitespace

Remove leading and trailing whitespace from a Java string.

Java✓ Tested
JavaScriptStrings

Trim surrounding whitespace

Remove leading and trailing JavaScript string whitespace.

JavaScript✓ Tested