Program to replace the spaces of a string with a specific characterExplanationIn this program, we need to replace all the spaces present in the string with a specific character. One of the approach to accomplish this is by iterating through the string to find spaces. If spaces are present, then assign specific character in that index. Other approach is to use a built-in function replace function to replace space with a specific character. Algorithm
SolutionPythonOutput: String after replacing spaces with given character: Once-in-a-blue-moon COutput: String after replacing spaces with given character: Once-in-a-blue-moon JAVAOutput: String after replacing spaces with given character: Once-in-a-blue-moon C#Output: String after replacing spaces with given character: Once-in-a-blue-moon PHPOutput: String after replacing spaces with given character: Once-in-a-blue-moon Next Topic# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India