Where is char-supporting String funcions!



  • Apparently guys wrote the following masterpiece barely didn't find a
    function working with char type argument and then decided to write on
    their own:



    public int Find(String string,char x, int startPos) {

            int i;



            if (string.length() == 0)

                return -1;



            if (startPos >= string.length())

                return -1;



            byte[] byteArray = string.getBytes();

            for (i = startPos; i < byteArray.length; i++)

                if (byteArray[i] == x)

                    break;



            if (i == byteArray.length)

                return -1;

            else

                return i;

        }



    not talking that it's stupid it won't work for not-English words



  • Re: "
    not talking that it's stupid it won't work for not-English words"



    Do you mean due to unicode issues?  If yes, I agree completely.  If no, what do you mean?






  • Re: Where is char-supporting String functions!

    yeah,  I meant the Unicode issue. It is Java:-) you wouldn't
    believe but this is a part of a public API which they give to customers
    (not source at least) but ALL the code is like this. Most of classes'
    members are public and most of the functions as well. But they invented
    a new method of incapsulation control. Some of the public functions
    have in their doc clause a phrase "for internal use only!". WTF!!!
    Souldn't there be a way to revoke a programmer's license???:-)



  • I'd blame his manager who allowed him to do this job. Or his manager's manager who allowed his manager to do it:-) Really WTF



  • @rytrom said:

    But they invented
    a new method of incapsulation control. Some of the public functions
    have in their doc clause a phrase "for internal use only!". WTF!!!
    Souldn't there be a way to revoke a programmer's license???:-)


    You're sure they invented it? I can't be ***** to look it up now, but
    aren't there public methods in the Java API itself labeled like this?
    Could've been Qt though, I'm not sure...



  • Do you have an example of such code in Java? Gimme a link pls.



  • Java, of course. Should have known that. Why people still use that crappy language is still a miracle for me... [:P]



    And revoking programmers licenses?... If they keep this up like this,
    soon they will have lost all the above-average customers and all who
    are left are users who are to dumb to understand what kind of c**p this
    is...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.