|
Consider the LDAP way.
|( apple , banana , pear )
|
|
|
|
|
or the programming way
(apple | banana | pear)
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
I should add, no it's humans. Mixtec has constructs in it that would make your head spin. Like what they classify as "round things" is incomprehensible. Laundry detergent is round. AND THEY ALL HAVE PRONOUNS. So you have to know what's what. Also the language has way more verbs than nouns, such that you can't tell what kind of bag someone has except by describing how they're carrying it.
Also they don't have a word for smile.
Humans are ridiculous.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Quote:
else if(0==c) {
result.Append(list[0]);
} An empty list will now produce an ArgumentOutOfRangeException .
This should work with any IEnumerable list:
public static string JoinList<T>(this IEnumerable<T> list, string delimiter = ", ", string finalDelimiter = "or ")
{
int count = list.Count();
switch (count)
{
case 0:
{
return string.Empty;
}
case 1:
{
return Convert.ToString(list.First());
}
default:
{
int index = count;
var result = new StringBuilder();
foreach (var item in list)
{
if (result.Length != 0) result.Append(delimiter);
if (index == 1) result.Append(finalDelimiter);
result.Append(item);
--index;
}
return result.ToString();
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The Oxford comma (i.e. the comma before "and" or "or") is a style choice and optional.
In any event, assuming all elements of the list are unique, the solution is the same:
With comma:
var result = new StringBuilder();
list.ForEach(item => result.Append(item).Append(item == list.Last() ? "" : item == list.Take(list.Count - 1).Last() ? ", or " : ", "));
Or without comma:
var result = new StringBuilder();
list.ForEach(item => result.Append(item).Append(item == list.Last() ? "" : item == list.Take(list.Count - 1).Last() ? " or " : ", "));
|
|
|
|
|
I'd never create that many objects to solve such a mundane problem unless I was doing business dev.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Guess what I do?
Actually, as I wrote it, I did wonder about how efficient it is!
I don't think it creates that many objects; I think Take just builds a new List referencing the original elements. Last definitely just references the last element and doesn't copy it.
|
|
|
|
|
Other than when LINQ can combine them, all enumerations such as foreach, or any operating which takes any subset or combine of an enumeration will create an enumerator object.
You're creating a lot of them there. Well, 3 by my count. Basically every time you use a linq call, minus when linq can combine internally.
Edit: I should add, while it would be acceptable where I'm using it, I'm not currently referencing LINQ in my project and I wouldn't for a single situation like this.
It's easy enough to use LINQless code to achieve the same thing.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Alter conforms to filter (4)
|
|
|
|
|
FITS
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Um, now if you alter that...
|
|
|
|
|
Nature's best science photos of 2019: [^]Quote: He who can no longer pause to wonder and stand rapt in awe, is as good as dead; his eyes are closed. Albert Einstein
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Those are terrific images. I just wish they were higher resolution.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
Fascinating, thanks for posting!
|
|
|
|
|
Nice selection, thanks Bill!
|
|
|
|
|
Great photos. The quote illustrates the amazing depth of Einstein's thinking process. He wasn't just a brilliant mathematician, but had an appreciation for beauty around him as well. Those traits are often mutually exclusive.
|
|
|
|
|
Cool stuff. Thanks for sharing!
|
|
|
|
|
Just out of curiousity, how to y'all feel about using software bots? In particular the chatbots people seem to be pushing for customer service (in house). Would you rather use a chatbot to find out information, or just email the person that you know is responsible for the task?
TTFN - Kent
|
|
|
|
|
Chat bots are usually far from being anything else than a complete waste of time...
|
|
|
|
|
I've yet to find a service bot that was even in the slightest bit useful.
Emailing direct? Works like a charm. I've just finished an email session with a US company because a unit died inside it's two year warranty - a new one is on the way and (with luck and a following wind) will be here before Christmas. With a chatbot? I'd still be screaming at my screen in frustration as it dispenses more "solutions" to problems I don't have because it spotted a couple of keywords instead of reading the whole message history.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: as it dispenses more "solutions" to problems I don't have because it spotted a couple of keywords instead of reading the whole message history
You've just described just about every Microsoft answer on the Microsoft Answers site, and I don't think they're bots.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Half the time, they don't even look for keywords; they just give a lengthy description on how to perform a clean boot -- which never achieves anything.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Don't forget the instructions to run sfc /scannow and dism /online /cleanup-image /restorehealth , despite the fact that those commands have almost never solved a problem.
Followed by details of how to create a new user profile, or how to wipe your computer and start again.
The actual solution, which usually turns out to be a single option you need to tick/untick, tends to be a comment from another end user with the same problem, buried somewhere within 42 pages of useless "same problem here!" messages.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Now that is customer service!
... According to microsoft's definition.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
You mean those things that ask you basic questions and then hit a wall in about 2 seconds, which then pass you on to a real human who asks you exactly the same questions?
A great way to lose customers from my experience.
cheers
Chris Maunder
|
|
|
|