I would think that the latter is correct because there can be only one empty string, that is "", or equivalent ''. Yet the former reads somewhat more natural to me. I came to think about articles with respect to empty string when I was writing the following snippet of python code:

internal_linkMarkupStart = "[[" # to be replaced with @

internal_linkMarkupEnd = "]]" # to be replaced with an empty string

Whereas the results of Ngrams point to an empty string being the correct one, I'm hesitant to regard them as conclusive due to their scarcity (with the empty string yielded only one result). I find analysing posts on Stackoverflow of not much use, as many users with high reputation earned it primarily not through their command of English.

  • 1
    Is "" the same empty string as ''? If you define a variable called emptyString and use that in your code instead of "" now how many empty strings are there? Seems this is more a philosophical question than a grammar question.
    – nnnnnn
    Commented Aug 4, 2020 at 9:42
  • @nnnnnn Let us assign a value to the variable emptyString, likeso: emptyString = "". Now, "" has the same value, of an empty string, as '', as well as the variable emptyString. The value is only one, though it can be assigned to many variables. In my code snippet I meant just the value of "", that's why I think that the empty string is correct.
    – John Smith
    Commented Aug 4, 2020 at 11:01
  • 3
    Either one is correct, depending on the meaning implied. Note that in some computer languages there is only one "empty string" object.
    – Hot Licks
    Commented Aug 4, 2020 at 11:47

3 Answers 3


Give or take, the statement

there can be only one empty string, that is ""

could be considered true. It just depends on how deep you want to take that question (what about a variable of string type with a value of null or nil, does a char variable of '' count as equivalent to a string variable ""? (JavaScript would consider this == vs ===, but I digress))

And for the scope of the question, we will treat that statement as true, which would allude to the usage of "the" rather than "an," since "there can only be one."

But, consider

var str1 = "";
var str2 = "";

There is now more than one empty string, as the empty string is stored in two separate variables, or two separate strings, and therefore there exists two strings at different addresses in the computer's memory, both of which are empty.

So I think "an empty string" is more widely used because you're alluding to the possible existence of more than one string, rather than the existence of more than one empty-string. It wouldn't matter if you used str1 or str2 because they are both empty strings. That's why most people use "an empty string."

But "more widely used" doesn't mean "the only correct way"; use what seems more correct to you, and just know that both ways are fine.


hash to be replaced with an empty string

An empty string = an/any example of an empty string.

hash to be replaced with the empty string

the empty string = that empty string that has been [or will be] defined; that empty string of which we are all aware.

  • '#' in my code is just a markup sign that marks the beginning of the comment. The values to be replaced by the empty string are "[[" and "]]". I already improved formatting of my code and edited somewhat the your answer.
    – John Smith
    Commented Aug 5, 2020 at 20:50

This appears to me as the classic question of definite and indefinite articles.

English has two articles: the and a/an.

The is used to refer to specific or particular nouns; a/an is used to modify non-specific or non-particular nouns.

In your example empty string itself is specified in Python by a pair of double/single quotes i.e "".

Hence "the empty string" is correct usage.

  • I don't understand why people don't read suggestions. After downvoting, as a responsible user of the site you are supposed to write a comment.
    – Rahul
    Commented Aug 4, 2020 at 14:50
  • 2
    Okay, I'll downvote you and add a comment. Just because all empty strings are identical, it doesn't mean that you have to use "the". Similarly, all electrons are identical, and we say "an electron". Both electrons and empty strings actually differ even though they are identical, in that they occupy different locations. Similarly, there is only typographical letter "y", but in correcting a typo, you would say "you need to add a 'y' to 'empt string' ". Commented Aug 5, 2020 at 12:16
  • 1
    This doesn't mean that I think "the" is wrong here—I think both articles are acceptable. Commented Aug 5, 2020 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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