Questions tagged [spaces]

The space character, `U+0020`, used to separate words/tokens in most natural and programming languages.

The space character, U+0020, used to separate words/tokens in most natural and programming languages. Space is a whitespace character.

Spaces are frequently of concern to programmers in the context of languages with significant whitespace (e.g. Python), source code indentation, and separating tokens. Separating tokens correctly is important for shell scripts, URIs, file names/paths, text processing, and string formatting. Questions regarding all of these areas are common on Stack Overflow, as spaces appearing unexpectedly can cause unexpected behavior whose source is not immediately obvious.

"Spaces" may also refer to the virtual desktop functionality of Mac OS X, first referred to as "Spaces" in OS X 10.5.

1024 questions
-2
votes
1 answer

Get a line with spaces of unknown size

I want to read a string, the string can contain spaces. I tried: char* str; cin >> str; // but I have to allocate a memory by making new so I think about: string str; cin >> str; but it reads until the first space. can someone know how can I get…
Alon Shmiel
  • 6,753
  • 23
  • 90
  • 138
-2
votes
3 answers

How to remove the spaces in string in javascript

I would like to avoid spaces from a string in javascript. I would like to remove spaces not only infront and after of the string , instead I would like to remove spaces from the string (front,in between the characters and end). Thanks in adavance
Technosavia
  • 85
  • 2
  • 12
-2
votes
2 answers

How to omit the spaces in a string

I need to write a program that will read in a sentence and output the number of words in the sentence. I have the program done, but the problem is that my program is counting the spaces inbetween the words as characters. How do I omit those spaces…
Matthew Young
  • 29
  • 1
  • 2
  • 4
-2
votes
6 answers

For loop to separate a string with spaces (Java)

Is there a way to create some type of For loop to separate a string with spaces? So far I can display a string and find how many characters it has. import java.util.Scanner; import java.lang.String; public class Word{ public static void…
jerms246
  • 61
  • 2
  • 2
  • 7
-3
votes
1 answer

Removing the file name spaces of a browsed file or the input file

We're working on a converter but How can we remove the file name of the browsed file, not the string typed by the users
-3
votes
3 answers

How to remove a white space at the end of a string in java?

I am trying to remove exactly one white space at the end of a string. eg. I want " XXXX " to be " XXXX". The trim() method in java removes all leading and trailing whitespaces. Any help will be appreciated :)
-3
votes
3 answers

Remove a certain character from a .txt file

If I type java DeleteX e < input.txt > output.txt in the terminal, the code is supposed to remove a certain character (in this case e) from the input.txt file and then save the same text to a new file output.txt but all the es should be…
Nudd3
  • 29
  • 4
-3
votes
2 answers

How do I keep spaces in a my encoded message?

I'm taking the inputted message, adding 2 to the Unicode value of each letter, and then printing it out I'm having trouble including the spaces between the words. If the phrase was cheese pizza, it would print out "ejggj" and then stop at the space.…
user7432780
-3
votes
1 answer

how to put spaces after numbers in a string js

I have a task to return number of a letter in alphabet instead of given letters. So, if I have the word 'Wow!' - I should return '23 15 23'. the problem is I can't put spaces between numbers and have result '231523'. When I try to put it I have an…
-3
votes
1 answer

how to echo data as it is in the DB the same format?

I am developing web application the data in the database is like this " 10 Functions Touch Control LCD display Electric programmer with: Minute minder, automatic start Automatic end of cooking End cooking acoustic alarm Additional Menu…
-3
votes
2 answers

Given a line, how do I print it without any spaces?

Here is the problem I'm working on: Given an inputted line of text, print it without any spaces. This is my attempt at a solution: #include int main() { using namespace std; std::string text; cin >> text; for(int i=0;…
-4
votes
4 answers

Python code for inserting a variable number of spaces into a string, to space out two given strings

This may sound odd, but I want to be able to insert a varying certain number of spaces between two strings. So, in some cases it may be 10 spaces, in other cases 5 space or anything in that range, so that together the first string plus the empty…
A Feldman
  • 1
  • 2
-4
votes
1 answer

How to remove spaces in Json keys?

Example: Input: {"Contact Title": "Owner Name"} Expected Output: {"ContactTitle": "Owner Name"}
-4
votes
1 answer

delete space in one line prints

How to remove spaces in this print ? For example for i in range(5): print i, Will prints: 1 2 3 4 5 But I would like to get print like: 12345 Someone can help ?
ReVaN
  • 15
  • 5
-4
votes
4 answers

Remove spaces between digits in a string

original: "I have the M5 2 0 0 and I like it" intended: "I have the M5200 and I like it" How would you achieve this as an algoritm or give a code example? I believe this question is valid in many programming languages so I won't ask it for a…
Adrian Cumpanasu
  • 1,028
  • 1
  • 10
  • 24
1 2 3
68
69