|
Left isn't a method of the String class in VB.NET either. It's hidden in the Microsoft.VisualBasic.Strings class. I work in VB.NET all the time and just created my own Left extension method, just like you would in C#.
|
|
|
|
|
C# doesn't have ANY methods on string. The methods on string are part of the .NET framework, and are the same for any .NET language - C#, VB, F#, you name it.
|
|
|
|
|
Wow, go do some string manipulations in ANSI C, that'll give you something to complain about
As a general rule, the more powerful the language the more responsibility the programmer has for implementing algorithms correctly. Checking bounds before taking a bite out of an array is basic stuff, why should the language hold your hand for that?
This kind of thing annoys me about VB, getting back a string that is shorter than the length you specified is like just having the language ignore an exception and give an arbitrary result. It's not what you asked for, and you shouldn't get it. What if code down the line is expecting the string to be that exact length?
|
|
|
|
|
StatementTerminator wrote: This kind of thing annoys me about VB, getting back a string that is shorter than the length you specified is like just having the language ignore an exception and give an arbitrary result. Not even close. It's like being a human.
If you asked someone, "hey, give me the first 100 characters of the phrase 'i love VB'", would you expect them to yell at you with an exception or to just return your string? Maybe you think too much like a computer instead of a human.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
RyanDev wrote: If you asked someone, "hey, give me the first 100 characters of the phrase 'i love VB'", would you expect them to yell at you with an exception or to just return your string?
I would expect different answers from different people, which is exactly the point. And yes, I would be the elephanting Vulcan who says that the question is unanswerable, because what is being asked for can't be given.
|
|
|
|
|
Give me the first 100 digits of 10.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
10.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
|
|
|
Exactly.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Add a reference to Visual Basic and just use the left function from VB
string test = "Hello World";
string shortTest = Microsoft.VisualBasic.Strings.Left(test, 5);
Console.WriteLine(shortTest);
|
|
|
|
|
I know.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Func<string, int, string> Left = ( s, n ) => s.PadRight( n + 1 ).Remove( n );
Console.WriteLine( Left( "FooBar", 3 ) );
Console.WriteLine( Left( "", 6 ) + "*" );
Console.ReadKey();
|
|
|
|
|
I miss VB too. Somehow it's very good at dodging bullets.
We're philosophical about power outages here. A.C. come, A.C. go.
|
|
|
|
|
Once a year the management company for the buildings on the campus where I am hold a client appreciation day and gives everyone free burgers and ice cream. You get a ticket for each. I just got given a second set of tickets.
Oh, it's in-n-out so
Gotta love a free lunch!
|
|
|
|
|
I'm staying at a hotel right now. Directly across the street is an In-n-Out burger, and there is a line of cars probably 25 long ALL DAY up until they close at 10:30pm...
I don't get it. Their burgers are, IMHO, less than average. I don't see the fascination people have with In-n-Out burger. I sure as hell wouldn't sit in a line of cars that long any time day or night for their average food.
If it's not broken, fix it until it is
|
|
|
|
|
Is it owned by Gus Fring's brother?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Yeah, people are weird. I remember when the first Chick-fil-a opened in Kansas City - people were CAMPED out for 2 days(!), waiting for it to open. Their food is not bad, but really?!
|
|
|
|
|
Kevin Marois wrote: I don't see the fascination people have with In-n-Out burger Have you ever walked into a mall and seen a crowd lined up to get macdonalds rubbish and next door - selling the same quality of rubbish or possibly better, is deserted.
It all comes down to marketing, bloody hell we are probably the most susceptible, we use MS to make a living and it is built on marketing.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Not quite marketing as you put it.
Once upon a time I watched a "Hamburger: the Motion Picture". One of the points brought up by two characters discussing why people by the things:
It's a matter of feeling safe. They know what they're getting. They'd rather not risk something new that they may not like.
So, they buy the clown-feces because they know they can rely upon what clown feces taste like.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Had In-n-Out once... didn't live up to the hype.
|
|
|
|
|
Tim Carmichael wrote: In-n-Out
Never heard of 'em over here in Canada.
"In and out" the same hole?
|
|
|
|
|
My dinner may not be free, but I have two burgers on the grill at this moment. <torture> And lots of bacon.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
In-n-Out burgers are the best. Too bad they are not out east.
|
|
|
|
|
R. Giskard Reventlov wrote: Gotta love a free lunch! Well, I'd love it if it were food.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
It was pretty good for a burger. So good that I had 2.
|
|
|
|
|
Ah. Not MacRegurgitatedmince, then.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|