Results for “Strings & literal text”
Small, practical examples. Search by task or narrow things down below.
Open a link in a separate tab
Declare a separate browsing context with an explicit noopener relationship.
HTML✓ 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
Parse JSON into an object
Access a named field in a JSON document.
JSON✓ Tested
Preserve whitespace while wrapping
Use CSS pre-wrap for multiline text that retains spaces.
CSS✓ Tested
Print a label beside a number
Arduino / C: Combine Serial.print and Serial.println to put text and a value on one line.
Arduino / C✓ Tested
Read a data attribute
Read an element data attribute with jQuery data.
jQuery✓ Tested
Read a file line by line
Read C++ text lines without loading the whole file at once.
C++✓ Tested
Read a JSON file
Load a JSON document from disk into Python objects using an explicitly selected text encoding.
json✓ Tested
Read a small INI configuration
Python: Use ConfigParser typed accessors for configuration values stored as text.
Python✓ Tested
Read a UTF-8 file
Read a small file as text using Node.js.
JavaScript✓ Tested
Remove a filename extension
Keep the path while removing its final extension.
filename✓ Tested
Remove a trailing line ending
Use strcspn to terminate a C string at its first newline or carriage return.
C✓ Tested