Take a simple example:

string1 = ""
string2 = "foo"

string1 is empty or null, which is clear.

But what about string2? I wouldn't call it "full". "Non-empty" or "non-null" works, but is there not a single word that unambiguously captures the meaning of "not empty" in the context of a string?

  • 1
    In the context of mathematics, it would probably be called "nontrivial." I don't know of any term in CS. – David Pement Dec 23 '20 at 14:57
  • 1
    If the downvoter can suggest any way to improve this question, that would be appreciated! – Lou Dec 23 '20 at 15:17
  • 2
    Part of the community here downvotes every "name that thing" question categorically (which would be ok for me if they would leave a comment on it, which they usually don't). When you read this old meta post from 2014, there was IMHO not a real consensus of a question like this one should be accepted. The community today is even more picky about it. ... – Doc Brown Dec 23 '20 at 16:53
  • 1
    What is the context (reasoning) that necessitates a single-word terminology for non-empty strings? Please explain. – rwong Dec 23 '20 at 17:35
  • 1
    @gnasher729 - the problem with that is that, while technically correct, you're writing for human readers, and that's not how humans normally talk (even if they are mathematicians :) ). Furthermore, if the reader has no context about how precise, and how consistently precise, the language used for naming is, it doesn't make the name less ambiguous. So redundancy in the name is not necessarily a bad thing - it's a bit of a judgement call, depending on how well you know your "readership". – Filip Milovanović Dec 23 '20 at 19:29

A variable that is assigned a value is said to be "populated."

That's about as close as you're going to get, unfortunately. A populated string variable (or a string of non-zero length) is just not interesting enough in and of itself to ascribe a single-word term.

  • Huh, I suspected this would be the case, but thanks. Your display pic is beautiful, by the way ;-) – Lou Dec 23 '20 at 15:40

At least one of the languages I use, chose the pragmatic solution: nonempty. Bam. One word.


As well as endorsing Robert Harvey's word "populated", I'd like to suggest the words replete or even impleted as the opposite of empty.

Although these words are more or less a synonym of "full", and perhaps even over-fullness and excess, in this context they're far more unusual words than "full" with fewer connotations of wholeness or limited capacity, and a stronger connotation of there being a complement of one or more individual items present (which is the same connotation that "populated" carries).

For example, you can use "full" like "he ate a full cake", which means the entirety of a single cake, not multiple cakes. Or "the dungeon was full" strongly suggests that it has reached its capacity, not that it is merely populated. These are connotations which make it unsuitable to talk of a "full string", which can be as little as one character or an indefinite number of characters.

They're also snappy words and not needlessly long to write or pronounce.

I seem to remember a similar question arising recently, and should I myself encounter a need to describe something (a container, array, string, etc.) that is "nonempty", I think "replete" may well be the word I turn to.

Correspondingly, I could well envisage myself generically describing a string that consists only either of a null, an empty string, or whitespace, as "nonreplete".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.