How can i Convert this sentence "hello , world , program" to "hello!world! program " in java language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How can i Convert this sentence "hello , world , program" to "hello!world! program " in java language

17th Jul 2022, 11:33 PM
Fatma hgazy
Fatma hgazy - avatar
10 Answers
+ 6
Yes, that is exactly the purpose of replaceAll() method. You just need to know what to find and what to replace it with.
18th Jul 2022, 2:27 AM
Ipang
+ 4
Do you mean to print an exclamation after each word? "hello, world, program" "hello! world! program!" Like that, or did you mean something else?
18th Jul 2022, 1:34 AM
Ipang
+ 4
Fatma hgazy Before your thread becomes too messy, and you can't get proper help, pls edit your question and add this to the description: 1. A complete and meaningful explanation of what the code should do and how 2. A link to your attempt in Code Playground (pls do not copy/paste it) 3. An explanation of your difficulties Pls don't spread this info in answers. This way, people will know what help you need and everyone starts going in the same direction.
18th Jul 2022, 2:25 AM
Emerson Prado
Emerson Prado - avatar
+ 2
language? code?
17th Jul 2022, 11:43 PM
Slick
Slick - avatar
+ 2
Yes i mean that
18th Jul 2022, 1:37 AM
Fatma hgazy
Fatma hgazy - avatar
+ 2
You can do this easily by replacing the commas with exclamation mark. You see? original string is "hello , world , program" By replacing all " , " (space surrounded comma) by "!" (rxclamation mark) - you can get such result "hello! world! program" Refer this for syntax and example https://www.javatpoint.com/java-string-replaceall
18th Jul 2022, 1:45 AM
Ipang
+ 2
Are you understand me🥺?
18th Jul 2022, 2:08 AM
Fatma hgazy
Fatma hgazy - avatar
+ 1
Fatma hgazy "hello, world, program" to "hello! world! program" is just replacing all the commas with exclamation marks right? Or do you mean something else? Just link your code, so we can understand what you're trying to ask
18th Jul 2022, 6:59 AM
Kruti
Kruti - avatar
0
No something else
18th Jul 2022, 1:40 AM
Fatma hgazy
Fatma hgazy - avatar
0
No i want to convert this string from "hello, world, program" to "hello!world! program"
18th Jul 2022, 2:08 AM
Fatma hgazy
Fatma hgazy - avatar