I'm currently writing some C# extension methods dealing with string parsing, and I like to be terse yet descriptive and accurate in my method names.
Question: Is there a good word or phrase that describes the opposite of white space?
To be clear, this set of characters are visible and would consume ink if printed on paper. But I don't care to use terms related to ink, paper, or printing, nor do I want to assume any particular colors.
VisibleCharacters seems the most technically accurate but a bit long.
NonWhiteSpace seems like a double negative to me. I'd rather deal in what something IS, rather than what it IS NOT.
Thanks.
I went with the word "glyph", and called my function HasGlyph.
It seems to correctly cover characters which are readable, visible and printable; but does not refer to white-space or control characters. It doesn't assume that the character is being displayed graphically or is being printed. It doesn't assume any color. It also covers letters, numbers, and shapes.
Plus, its also a very short name.
http://en.wikipedia.org/wiki/Glyph
In case you're curious, my extension method:
public static bool HasGlyph(this string value)
{
if (string.IsNullOrWhitespace(value)) return false;
// TODO: Not 100% sure if the opposite of the IsNullOrWhitespace method covers what I want, but its good enough until I find out otherwise.
return true;
}
If you really mean everything but whitespace, I would suggest using the term non-whitespace character. This is also what the Perl documentation does for the \S character class, see the perlre and perlrecharclass manual pages (search for \S).
This term
non-blank (with blank usually referring to the character with ASCII code 32)Note that this definition includes characters like NUL or ESC that are neither whitespace (because they do not actually insert any kind of space) nor graphic / printable. So maybe you really want to limit yourself to graphic characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With