Very funny, posting a VB answer for C# homework :-)
> > Hello, I'm new to c$
> > I need help writing a function that matches a word only if the word is
[quoted text clipped - 24 lines]
> HTH,
> Mythran
Marina - 06 Sep 2005 18:10 GMT
Not to mention, it's not really quite the correct answer, as the second
function will throw an error if the word is shorter then Count...
> Very funny, posting a VB answer for C# homework :-)
>
[quoted text clipped - 27 lines]
>> HTH,
>> Mythran
LogixSR79 - 06 Sep 2005 18:23 GMT
Well funny if you don't realize that the .net framework trancends VB, C# and
C++
For C# it is nearly the same as VB:
And since im lazy this is word for word from MSDN
StartsWith:
[Visual Basic]
Dim MyString As String = "Hello World"
Console.WriteLine(MyString.StartsWith("Hello"))
[C#]
string MyString = "Hello World";
Console.WriteLine(MyString.StartsWith("Hello"));
EndsWith:
[Visual Basic]
Dim MyString As String = "Hello World"
Console.WriteLine(MyString.EndsWith("Hello"))
[C#]
string MyString = "Hello World";
Console.WriteLine(MyString.EndsWith("Hello"));
Now i'm sure you can figure it out from this point LOL
But if you have to do it programmatically on your own then get the length of
the word to test for and skip back that much in the string to test in and
see if it compares true, might want to trim spaces at end, don't know how in
depth it needs to be...
> Very funny, posting a VB answer for C# homework :-)
>
[quoted text clipped - 27 lines]
>> HTH,
>> Mythran
LogixSR79 - 06 Sep 2005 18:24 GMT
> Well funny if you don't realize that the .net framework trancends VB, C#
> and C++
Okay well it is funny considering original post went to C# NG as well :P
> For C# it is nearly the same as VB:
>
[quoted text clipped - 57 lines]
>>> HTH,
>>> Mythran
Mythran - 06 Sep 2005 18:34 GMT
w00ps :)
public bool AtEndOfString(string Text, string Word)
{
return Text.EndsWith(Word);
}
public string GetBeginningOfString(string Text, int Count)
{
if (Text != string.Empty && Text != null && Text.Length >= Count) {
return Text.SubString(0, Count);
}
return Text;
}
Sorry about the reply in VB.Net, I'm stuck on VB today :) Oh yeah, this was
off top of my head, so it's not tested :)
HTH :)
Mythran
> Very funny, posting a VB answer for C# homework :-)
>
[quoted text clipped - 11 lines]
>> HTH,
>> Mythran
billy - 07 Sep 2005 13:27 GMT
> Very funny, posting a VB answer for C# homework :-)
Just curious, why don't you do your own homework? You're doing yourself
more harm than good coming to newsgroups for quick answers and you're
developing bad habits that are most likely going to stick with you your
whole career. This stuff here is very simple and you're setting yourself
up for a tough road ahead if you can't get through it. Sorry for
sounding like a creep but the software development community as whole
already is forgetting how to think for itself and the overabundance and
accessibility of "answers" is making things worse.
~billy