Results for “Strings & Unicode”
Small, practical examples. Search by task or narrow things down below.
Inspect a parsed URI
C#: Use Uri properties instead of splitting URL strings manually.
C#✓ Tested
Join transformed stream values
Java: Use Collectors.joining after converting elements to strings.
Java✓ Tested
Measure a string length
Count bytes before the null terminator with C strlen.
C✓ Tested
Pad a numeric label
Convert a number to text and pad it to a fixed width.
JavaScript✓ Tested
Parse and format a date
Convert a date string into a datetime object, then format it in a different, human-readable order.
date✓ Tested
Read rows from CSV text
Parse CSV into objects with named properties.
CSV✓ Tested
Remove a trailing line ending
Use strcspn to terminate a C string at its first newline or carriage return.
C✓ Tested
Replace all literal matches
Replace repeated substrings with JavaScript replaceAll.
JavaScript✓ Tested
Replace literal text
Replace every literal occurrence in a C# string.
C#✓ Tested
Replace literal text
Replace all literal matches in a Java string without regular expressions.
Java✓ 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
Replace the first match
Find and replace one literal substring in C++.
C++✓ Tested