Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

I'm writing up some documentation, and I'm unsure which phrase to use:

Option X: Find all strings ending with foo.

or

Option X: Find all strings ending in foo.

Are both correct? (Google spits out both, strongly favoring with.) Which should I prefer?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

"Ends in" is acceptable in the sense that words can end in a vowel; end in an "a"; etc. This is often shortened to:

"Word" ends in "d"

"Ends with" seems to fulfill the same use:

"Word" ends with "d"

But I typically think of "ends with" using larger things than letters:

"This phrase" ends with "phrase"

"This is a sentence" that ends with "sentence"

Really, though, both "in" and "with" are doable:

"Hungry" and "angry" both end in "gry."

"Hungry" and "angry" both end with "gry."

The only difference I can find is their usage outside of words:

Our journey ends in Texas.

Our journey ends with disaster.

To directly answer your question, both work just fine in the original context. Some people prefer one over the other; some workplaces will have a strict style guide dictating which should be used. At the end of the day, consistency is more important.

As for references, there isn't much to find other than looking at hits via Google. NGram searching for "ends in/with c" shows:

enter image description here

But that really doesn't mean much, given the propensity for quirks in searching algorithms. Just browsing pages found by Google is of virtually no help given how often people use both phrases.

share|improve this answer
    
What I great and insightful response. It is the best answer I got. I have asked several grammarians about this. Thank you very much. –  Nikolai May 4 '11 at 22:36
add comment

Close call. I would say that "in" is asking for a very precise case, whereas "with" is for more general usage. For example:

Which words end in "ces"?

but

Which words end with a vowel

share|improve this answer
add comment

I would go with

Option X: Find all strings ending with foo.

It sounds more solid.

share|improve this answer
    
Thanks. Is "sounds more solid" the opposite of "sounds a bit shaky", or does it imply something else? :-) –  Martin Jan 18 '11 at 9:33
    
It doesn't mean anything else, I just think that it's more convenient to use with. Personally, I've never seen ending in in technical documentations. That doesn't mean it's wrong, of course. It's up to you. ;) –  Mehper C. Palavuzlar Jan 18 '11 at 9:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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