[Help] StringBuilder sb null?

Results 1 to 6 of 6
  1. #1
    Account Upgraded | Title Enabled! TacoBell is offline
    MemberRank
    Aug 2011 Join Date
    518Posts

    [Help] StringBuilder sb null?

    Hello! I'm trying to use null for StringBuilder but everytime I use it I get an error. Is there any way to set it to null for my command? The command is set to
    PHP Code:
    @tag <on/off
    which enables <Donator> <ign> if you're a donator and whenever you use a megaphone.



  2. #2
    Account Upgraded | Title Enabled! ngnam87 is offline
    MemberRank
    Mar 2013 Join Date
    666Posts

    Re: [Help] StringBuilder sb null?

    use sb.append(""); instead of sb.append(null);

  3. #3
    Account Upgraded | Title Enabled! TacoBell is offline
    MemberRank
    Aug 2011 Join Date
    518Posts

    Re: [Help] StringBuilder sb null?

    Quote Originally Posted by ngnam87 View Post
    use sb.append(""); instead of sb.append(null);
    I literally found that out 2 minutes after I posted the thread and signed in to help close it lmfao. I had a brain fart. Thanks for the help though! :D

    Close Thread Plawx

  4. #4
    Member Drum is offline
    MemberRank
    Jul 2013 Join Date
    80Posts

    Re: [Help] StringBuilder sb null?

    Also, what I might say about this, is that most programmers (I think) don't explicitly compare boolean values. Since c.getTag() returns a boolean (which satisfies the syntax for an if statement), why should you have to compare it to another boolean?

    It's not wrong, it's just....unnecessary. I also find it harder to read your way (although that is probably because I'm not used to it).

  5. #5
    Banned AmazonDrone is offline
    BannedRank
    Dec 2013 Join Date
    36Posts

    Re: [Help] StringBuilder sb null?

    If it's true, i'm sure false won't show so there's no point in doing a check for if addTag is false, just sayin.

  6. #6
    Account Upgraded | Title Enabled! AristoCat is offline
    MemberRank
    Apr 2012 Join Date
    947Posts

    Re: [Help] StringBuilder sb null?

    Use if(b) to check if boolean is true or if (!b) to check if boolean is false.



Advertisement