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
10
votes
1 answer

How to prevent MATLAB printing false space and use wrong fonts?

Matlab 2015a inserts space before µ in long strings, but not in short ones (xlabel). In some cases one can work around by using UTF-8 letters, but this will fail in other situations (see ^2) The font of the text should be Helvetica but it looks…
Jonas Stein
  • 6,826
  • 7
  • 40
  • 72
10
votes
3 answers

std::cin skips white spaces

So I am trying to write a function to check whether a word is in a sentence, by looping through a char array and checking for the same string of char's. The program works as long as the Sentence doesn't have any spaces. I googled around and they are…
Pejman Poh
  • 493
  • 2
  • 8
  • 20
10
votes
6 answers

C# - Easiest way to parse filename with spaces eg. "C:\Test\File with spaces.txt"

I am trying to pass a full file path to FFMPEG. C:\TestFolder\Input\Friends - Season 6 - Gag Reel.avi and it's obviously not liking the fact the path has spaces in it, erroring like so: C:\TestFolder\Input\Friends: no such file or directory So…
Dominic Bou-Samra
  • 14,799
  • 26
  • 100
  • 156
10
votes
5 answers

Is there a way to create a shortcut in Eclipse that would jump the cursor to the nth column in the current row?

I have to follow some strict indentation rules of Java code. In many cases I have to jump to the 26th or 28th column of the current row. The characters between my original location and the 26th/28th column should be space characters (not TABs). Is…
Eran
  • 387,369
  • 54
  • 702
  • 768
9
votes
2 answers

Moving a Window to a New Space in Mission Control

I would like to write a small utility that moves a window from one space to another in OS X Lion. I don't care if the utility is written in AppleScript or Objective-C. What I can't seem to figure out is given a window, how can I move it to a…
LandonSchropp
  • 10,084
  • 22
  • 86
  • 149
9
votes
9 answers

Runtime.exec on argument containing multiple spaces

How can I make the following run? public class ExecTest { public static void main(String[] args) { try { //Notice the multiple spaces in the argument String[] cmd = {"explorer.exe", "/select,\"C:\\New Folder\\file.txt\""}; …
Minos
  • 151
  • 1
  • 1
  • 7
9
votes
2 answers

REGEX To accept numbers separated by commas, but number range is 0-32767

I need to write a regular expression for taking input like this 23,456,22,1,32767 i.e. No commas allowed at the start or end. Spaces may come before and/or start of comma for e.g. 23, 45,56 ,67 etc. Ranges of each number should be…
Basmah
  • 829
  • 3
  • 13
  • 25
9
votes
3 answers

Javascript window.open url with spaces and %

I'm trying window.open with a url with spaces: var msg = 'Hello, world!'; var url = 'http://yoursite.com'; var link = 'http://www.twitter.com/share?text=' + msg + '&url=' + url; window.open(link); Running this code will open a new window…
nymo
  • 532
  • 1
  • 5
  • 14
9
votes
5 answers

Maintaining Maximum Line Length When Using Tabs Instead of Spaces?

Style guides for various languages recommend a maximum line length range of 80–100 characters for readability and comprehension. My question is, how do people using tabs for indentation comply with the line length limits? Because, if the length of a…
its_me
  • 10,998
  • 25
  • 82
  • 130
8
votes
2 answers

file_get_contents with spaces in URL

I have an issue where even if I replace the spaces to %20 and get this content the ultimate url the browser gets turns the "%20" into "%2520" Here's my code, any suggestions to get this to work? it seems easy but I'm stuck :/
d-_-b
  • 21,536
  • 40
  • 150
  • 256
8
votes
1 answer

specify number of spaces between pandas DataFrame columns when printing

When you print a pandas DataFrame, which calls DataFrame.to_string, it normally inserts a minimum of 2 spaces between the columns. For example, this code import pandas as pd df = pd.DataFrame( { "c1" : ("a", "bb", "ccc", "dddd", "eeeeee"), …
HaroldFinch
  • 762
  • 1
  • 6
  • 17
8
votes
4 answers

Remove excess white space from string

I want to remove the excess white spaces using VB.net ex. "The Quick Brown Fox" I want output "The Quick Brown Fox" Thanks, inchika
maria
  • 81
  • 1
  • 1
  • 2
8
votes
7 answers

C programming: print only int from fgets

See this main: int main(void) { int i; int ch; char str[512]; fgets(str, sizeof str, stdin); for (i = 0; i <= (strlen(str)); i++) { if (str[i] != '\0' && str[i] != '\n') { int num =…
user2908206
  • 265
  • 3
  • 16
8
votes
3 answers

BASH shell expand arguments with spaces from variable

Say I have a variable $ARGS which contains the following: file1.txt "second file.txt" file3.txt How can I pass the contents of $ARGS as arguments to a command (say cat $ARGS, for example), treating "second file.txt" as one argument and not…
8
votes
1 answer

Unnecessary spaces in Verilog Display

I'm trying to display some 32 bit values in decimal, and this is working fine other than the strange amount of unecessary spaces between my %b and the previous character. for example: if i have a 32-bit reg a with a decimal value of 33, i'll use…
Jay
  • 85
  • 1
  • 5