Advertisement
Kirabo

Untitled

Jan 4th, 2017
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. public String bubblifyText(String tweet){
  2.  
  3.   int indexForSplitOne = tweet.length() / 3;
  4.   int indexForSplitTwo = indexForSplitOne * 2;
  5.  
  6.   while(tweet.charAt(indexForSplitOne) != ' ')
  7.   {
  8.     indexForSplitOne++;
  9.   }
  10.  
  11.   while(tweet.charAt(indexForSplitTwo) != ' ')
  12.   {
  13.     indexForSplitTwo++;
  14.   }
  15.  
  16.   String bubbleTweet = tweet.substring(0, indexForSplitOne - 1) + '\n' + tweet.substring(indexForSplitOne, indexForSplitTwo) + '\n' + tweet.substring(indexForSplitTwo);
  17.  
  18.   return bubbleTweet;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement