Load a JSON string into a data structure. Also create a new data structure and serialize it into JSON. Use objects and arrays (as appropriate for y
Continue ReadingC++: String Literals
Show literal specification of characters and strings. If supported, show how verbatim strings (quotes where escape sequences are quoted literally) and
Continue ReadingC++: Multisplit
It is often necessary to split a string into pieces based on several different (potentially multi-character) separator strings, while still retaining
Continue ReadingC++: Longest Common Subsequence
#include <algorithm> #include <string> #include <vector> #include <stdio.h> #include <string.h> // See http
Continue ReadingC++: Caesar Cipher
Implement a Caesar cipher, both encoding and decoding. The key is an integer from 1 to 25. This cipher rotates (either towards left or right) the
Continue ReadingC++: Count Occurrences of a Substring
The task is to either create a function, or show a built-in function, to count the number of non-overlapping occurrences of a substring inside a strin
Continue ReadingC++: Base64 Encode Data
Convert an array of bytes or binary string to the base64-encoding of that string and output that value. Use the icon for Rosetta Code as the data to c
Continue ReadingC++: Here Document
A here document (or "heredoc") is a way of specifying a text block, preserving the line breaks, indentation and other whitespace within the text. D
Continue ReadingC++: Compare a List of Strings
Given a list of arbitrarily many strings, show how to: test if they are all lexically equal test if every string is lexically less than the on
Continue ReadingC++: Execute a Markov Algorithm
Create an interpreter for a Markov Algorithm. Rules have the syntax: <ruleset> ::= ((<comment> | <rule>) <newline>+)* <c
Continue Reading