Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
C# is a bit bad
because that ugly language lacks to check if the string exists or not by that length
for example:
string.Substring(1,5) == "!add "
this would return an error if player chats below 5 letters
wtf C#
anyway, if you ever need to: here's my workaround.
namespace Extension
{
public static class StringExtension
{
public static string GetSubstring(this string s, int beg, int end = 0)
{
if (end != 0 && s.Substring(beg, end) != null)
return s.Substring(beg, end);
else if (end == 0 && s.Substring(beg) != null)
{
return s.Substring(beg);
}
else
return null;
}
}
}
shh i have returned
Offline
Can't you just use this:
try { string.Substring(1, 5); } catch { }
In this case, it would give you an error too and NOT even do it.
I've done this before, "try" and "catch." Still errored with Substring.
shh i have returned
Offline
It's been way too long since I did anything in C# so I might be missing something but why not just assign null to the variable inside the catch statement instead of leaving the catch statement empty?
"Sometimes failing a leap of faith is better than inching forward"
- ShinsukeIto
Offline
Can't you just do this:
if (string.StartsWith("!add"))
{}
but okie
try
{
string.Substring(0, 5);
}
catch (Exception excep)
{
try
{
string.Substring(0,4) //heres another cmd
}
catch(Exception except)
{
string.Substring(0,2) //oh hi dere im anuter commund
}
}
ALL MORE LENGTH ON TOP!
in bot words,
Top to below length number
Offline
[ Started around 1732490558.4945 - Generated in 0.038 seconds, 13 queries executed - Memory usage: 1.42 MiB (Peak: 1.53 MiB) ]