in , , ,

When you get help on StackOverflow from the person you least expect

When you get help on StackOverflow from the person you least expect | java-memes, stackoverflow-memes, stack-memes, try-memes, string-memes, function-memes, oop-memes, overflow-memes, IT-memes | ProgrammerHumor.io
java-memes, stackoverflow-memes, stack-memes, try-memes, string-memes, function-memes, oop-memes, overflow-memes, IT-memes | ProgrammerHumor.io

Content

Inserting one string into another string java I am trying to stick one string into the middle of another string, ex 13 String One "MonkeyPony"; String Two "Monkey"; 5 how would I put string two into string one so it would read something like MonkeMonkeyyPony? EDIT: I should have been more clear, basically what I’m trying to do is insert "Monkey" into the middle of "MonkeyPony" numerous times, so on the first time it would read "MonkeMonkeyyPony" on the second time it would read "MonkeMonMonkeykeyyPony" etc. string insert share improve this question edited Mar 15 ’13 at 22:55 asked Mar 15 ’13 at 22:16 user2150807 cos 103 02 03 011 add a comment 4 Answers active oldest votes 21 You don’t need to loop it because the loop is already handled in main. So you just need to use String’s substring function to reconstruct a String made of the first half of one, then the second, then the other half of the first. How do I know the loop is already in main? Because I assigned you this homework. share improve this answer answered Jul 9 ’14 at 4:15 CBGraham 515 07 0 13 12 Uff, that stings… Didn’t think your teacher was that smart, now did you… – WiErD0 Dec 17 ’14 at 15:58 put smoked glasses – dctremblay Mar 5 at 0:11