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
13
votes
5 answers

Why Angular removes spaces between inline tags?

I was surprised what Angular removes spaces between inline HTML tags following each other.

1 2 3

This code will be rendered as "123" instead of "1 2 3". Is this behavior…
Yuri Beliakov
  • 623
  • 7
  • 23
13
votes
2 answers

Running an EXE file using PowerShell from a directory with spaces in it

I'm trying to run MSTest.exe from C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. What's more, I'm taking all of the assemblies in my current directory and setting them as separate /testcontainer arguments. I cannot figure out how…
user467384
  • 1,137
  • 4
  • 22
  • 38
12
votes
5 answers

How to remove whitespace from Model attributes?

What's the simplest way to make sure models trim leading and trailing white space from string values. One inconvenient way seems to be a before_save filter -- although for something as common as removing white space from strings, maybe there's some…
Hopstream
  • 6,391
  • 11
  • 50
  • 81
12
votes
7 answers

Javascript to remove spaces from a textbox value

I've searched around for this a lot and can't find a specific example of what I'm trying to do. Basically I want to get the value of a textbox, by the name of the text box (not id). Then I want to remove ALL spaces, not just leading or trailing, but…
TMS
  • 143
  • 1
  • 1
  • 7
12
votes
5 answers

How to cope with spaces in file names when iterating results from git diff --name-only

A script I am working on needs to go through each file from a git diff. However, I don't know how to deal with spaces in the file name. Any files that have a space are split into "2 files". I know they need to be wrapped in " " but I don't know how…
chrispepper1989
  • 2,100
  • 2
  • 23
  • 48
12
votes
4 answers

HTML equivalent to   ...that DOES break;

If I want to force two visually displayed two spaces I can do this: FOO BAR  FOO BAR This would sidestep HTML's whitespace collapsing feature, but it also would result in line breaks like this: FOO BAR  FOO BAR Is there a…
emersonthis
  • 32,822
  • 59
  • 210
  • 375
12
votes
14 answers

How to replace custom tabs with spaces in a string, depend on the size of the tab?

I'm trying to write a python function not using any modules that will take a string that has tabs and replace the tabs with spaces appropriate for an inputted tabstop size. It can't just replace all size-n tabs by n spaces though, since a tab could…
Austin
  • 6,921
  • 12
  • 73
  • 138
11
votes
3 answers

how can i tell if a string contains ONLY digits and spaces in python using regex

I'm trying to write some script in python (using regex) and I have the following problem: I need to make sure that a string contains ONLY digits and spaces but it could contain any number of numbers. Meaning it should match to the strings: "213"…
Tomer Schweid
  • 325
  • 2
  • 5
  • 18
11
votes
5 answers

Removing spaces at the end of a string in java

Possible Duplicate: Strip Leading and Trailing Spaces From Java String When I import data to an application I need to get rid of the spaces at the end of certain strings but not those at the beginning, so I can't use trim()... I've set up a…
diminuta
  • 1,545
  • 8
  • 32
  • 55
10
votes
5 answers

How do I put two spaces after every period in our HTML?

I need there to be two spaces after every period in every sentence in our entire site (don't ask). One way to do it is to embark on manually adding a    after every single period. This will take several hours. We can't just find and replace…
SpaceNinja
  • 496
  • 7
  • 20
10
votes
2 answers

batch file: pass parameter with white spaces to function

I am using a batch file for backups. I pass the options to a function which calls the packaging executable. This works unless the parameters contain whitespaces. This is the relevant code: SET TARGET="%SAVEDIR%\XP.User.Documents.rar" SET…
Matthias Pospiech
  • 3,130
  • 18
  • 55
  • 76
10
votes
1 answer

json fieldnames spaces

I've such a json structure: info: { First Name: "Robert", Last Name: "Smith" } I'm tring to point to data with javascript using something like: "info.First Name" I know it's incorrect. How can I retrieve those information from the structure I…
Lopoc
  • 1,308
  • 5
  • 16
  • 26
10
votes
1 answer

How to configure ESLint for tabs instead of spaces?

I have a .eslintrc file in my root directory: { "extends": "airbnb", "env": { "browser": true, "node": true, "jquery": true }, "rules": { "no-unused-vars": [0,{"argsIgnorePartern": "res|next|~err"}], …
user7496931
  • 1,347
  • 3
  • 15
  • 32
10
votes
2 answers

Regex - match a string without having spaces

Building an regular expression that will reject an input string which contain spaces. I have a following expression, but its not working as well; ^[a-zA-Z0-9!@#*()+{}[\\];:,|\/\\\\_\S-]+$ Valid case String123/test //string without space Invalid…
Justin
  • 378
  • 1
  • 3
  • 12