How to make a string calculator ? Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to make a string calculator ? Java

What he need make - 100" + "500" Output: "100500" Input: "Hi World!" - "World!" Output: "Hi " Input: "Bye-bye!" - "World!" Output: "Bye-bye!" Input: "Java" * 5 Output: "JavaJavaJavaJavaJava" Input: "Example!!!" / 3 Output: "Exa"

20th Jun 2022, 10:44 AM
SexyVitalaLove
SexyVitalaLove - avatar
5 Answers
+ 5
I think you need to include more information and perhaps your attempt. Can you write your code into the code playground and attach that here? What does a string calculator do? What doesn't your code do?
20th Jun 2022, 10:52 AM
Ausgrindtube
Ausgrindtube - avatar
+ 3
You can separate each word in a sentence using split() and then you can put them in an array and take off the part you don't want etc
20th Jun 2022, 1:43 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
That's not how this forum is supposed to work. You now need to look up and do some work yourself. If there's a problem with your code, add it here and someone can help correct it.
20th Jun 2022, 2:38 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Can you please send me the code, how it will look like, I really need it, I will be grateful
20th Jun 2022, 1:56 PM
SexyVitalaLove
SexyVitalaLove - avatar
+ 1
Thx for help guys, you help me)
20th Jun 2022, 3:19 PM
SexyVitalaLove
SexyVitalaLove - avatar