1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jekas [21]
3 years ago
13

How do I find a space in my String and replace it? JAVA

Computers and Technology
1 answer:
Fantom [35]3 years ago
8 0

Answer:

This article shows how to use regex to remove spaces in between a String.

A string with spaces in between.

String text = "Hello World Java.";

We want to remove the spaces and display it as below:

Hello World Java.

1. Java regex remove spaces

In Java, we can use regex \\s+ to match whitespace characters, and replaceAll("\\s+", " ") to replace them with a single space.

Regex explanation.

`\\s` # Matches whitespace characters.

+ # One or more

StringRemoveSpaces.java

package com.mkyong.regex.string;

public class StringRemoveSpaces {

public static void main(String[] args) {

String text = "Hello World Java.";

String result = text.replaceAll("\\s+", " ");

System.out.println(result);

}

}

Output

Terminal

Hello World Java.

You might be interested in
Which administrative tool can you use to check your computer's health or troubleshoot problems with the operating system or soft
Fiesta28 [93]

Answer:

performance monitor

Explanation:

7 0
2 years ago
Read 2 more answers
Intel Centrino Technology is the combinatin of wirelesstechnology with the previous HT technology.
Kay [80]

Answer:

<u>False</u>

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

The Intel Centrino Technology is a product marketed and sold by the tech giant Intel, which offers a combination of their Wi-Fi and WiMax technologies in a single personal laptop. It does not offer Hyper threading Technology (HT) like some of the other Intel branded CPU's. Some of the CPU's that include hyper threading are the Core I3 series.

Therefore, based on the information stated above, we can see that the statement in the question in <u>False</u>.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
2 years ago
In saving a Visual Basic project properly , which of the following: two components part are involved ?
alina1380 [7]

Answer:

C) Project and Form

Explanation:

In saving a Visual Basic project properly, the following: two components part that is involved are:

1. Project - this is the project file that will be saved in the computer's memory. On the toolbar of a Visual Basic Editor, there is a "Save Project File" icon, which will be clicked to save a Project file.

2. File - the is the Visual Basic Editor's user interface. Just like "window" in Microsoft Office, it is the space used in writing or building the project file.

4 0
2 years ago
Given the function definition void something ( int a, int&amp; b ) { int c; c = a + 2; a = a* 3; b = c + a; } what is the output
timurjin [86]

Answer:

1 14 3

Explanation:

If that code fragment is put under a main() function and then it will yield the above output. According to the function something(), only changes in value second parameter will be reflected and first will be unchanged because second is passed by reference and the first one is passed as value so only address of 's' is passed, so, only its value is changed and the rest are same.

8 0
3 years ago
The navigation bar appears in the same position on each page and uses the same colors, fonts, and font styles.
Ivan

Answer:

true

Explanation:

I think that's what it has been in my time of classes

3 0
2 years ago
Other questions:
  • Launched in 1995, ________ has become the most popular web browser.
    6·1 answer
  • You have installed a streaming video service on your network. You want selected hosts to be able to access this service via a dy
    6·1 answer
  • What is the term used for the document that describes the scenes and sequence of a game?
    6·1 answer
  • Can somebody help me?
    11·1 answer
  • Briefly explain five measures you have undertaken to protect your confidential
    12·1 answer
  • anyone got a class named computer literacy? or sum similar to using Microsoft programs? i need a lotttt of help, im 3 units behi
    12·2 answers
  • The text between and defines the _____.
    15·1 answer
  • Write a valid HTML + Python page that will count numbered from 1 to 1,000,000?​
    9·1 answer
  • The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and eac
    12·1 answer
  • State whether the given HTML coding is True or False. &lt;HR SIZE=5 COLOR=YELLOW ALIGN=RIGHT WIDTH=75%&gt;​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!