Grabbing String from an Integer

Discussion in 'Resources' started by Revver, Mar 16, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Revver

    Hey guys, i thought i'd help people out with this problem as a few people have had this problem :)

    Here is the snippet:

    Code:
    public String grabStringFromInt(int start, String args[]) {
            String answer = " ";
            for(int x = start; x < args.length; x++) {
                answer = answer + args[x] + " ";
            }
            return answer;
        }
    
    Basically it calls a string in the args array depending on how many arguments are needed. It then calls the integer x (or start) and checks if it is less than the character length of the string (or args length). Finally it tells us that the answer is equal to the String length, grabbed by the amount of x.

    Cheers :)
     
Thread Status:
Not open for further replies.

Share This Page