In Swing, the password field has a getPassword() (returns char[]) method instead of the usual getText() (returns String) method. Similarly, I have com
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++: Split a string in C++
What’s the most elegant way to split a string in C++? The string can be assumed to be composed of words separated by whitespace. (Note that I’m
Continue ReadingRead/convert an InputStream to a String
If you have java.io.InputStream object, how should you process that object and produce a String? Suppose I have an InputStream that contains te
Continue ReadingC++ String Algorithms
[pt_view id="ce50e34ece"]
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++: FASTA Format
In bioinformatics, long character strings are often encoded in a format called FASTA. A FASTA file can contain several strings, each identified by a n
Continue ReadingC++: Increment a Numerical String
This task is about incrementing a numerical string. // standard C++ string stream operators #include <cstdlib> #include <string> #in
Continue ReadingC++: Empty String
Languages may have features for dealing specifically with empty strings (those containing no characters). The task is to: Demonstrate how to a
Continue ReadingC++: Copy a String
This task is about copying a string. Where it is relevant, distinguish between copying the contents of a string versus making an additional reference
Continue Reading