Advertisement
Hey_Donny

section

Apr 12th, 2022
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. /**
  2. * Prints out a section from string <>source</> with <>start</> as beginning index and <>end</> as final index.
  3. * @param source The string we take a section from.
  4. * @param start The index of the starting character.
  5. * @param end The index of the final character.
  6. * @return string output - the given section from source.
  7. *
  8. * @author Dimitar Naydenov
  9. */
  10.  
  11. public static String section(String source, int start, int end) {
  12. String output = "";
  13. for (int i = start; i <=end ; i++) {
  14. output += source.charAt(i);
  15. }
  16. return output;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement