spaces

Why does the cmd.exe shell on Windows fail with paths using a forward-slash ('/'') path separator?

不想你离开。 提交于 2019-11-26 20:37:46
问题 Just when I'd thought I'd seen it all with Windows path issues, I've now encountered a case that only fails when '/' (forward-slash) is used as the path separator is used: C:\temp\tcbugs>mkdir "dir1 with spaces" C:\temp\tcbugs>echo hi > "dir1 with spaces"\foo.txt C:\temp\tcbugs>type "dir1 with spaces\foo.txt" hi C:\temp\tcbugs>type "dir1 with spaces/foo.txt" The system cannot find the file specified. What is particularly interesting about this is that it appears to be specific to the cmd.exe

Can you make valid Makefiles without tab characters?

て烟熏妆下的殇ゞ 提交于 2019-11-26 18:55:37
问题 target: dependencies command1 command2 On my system (Mac OS X), make seems to require that that Makefiles have a tab character preceding the the content of each command line, or it throws a syntax error. This is an annoyance when creating or editing Makefiles because I have my editor set up to be all-spaces-all-the-time. Can you make valid Makefiles without tab characters? 回答1: This is a syntax oddity/requirement of make , it has nothing to do with Mac OS X. Unfortunately, there's nothing you

Selecting a database in mysql with spaces in its name

≡放荡痞女 提交于 2019-11-26 17:49:05
问题 I want to select my particular database in mysql console, but the problem is that my database name has a space in between and mysql ignores the part after the space. For instance, when i give the command: use 'student registration' I get the message: cannot find database 'student' 回答1: You should try using back ticks ("`") to quote your database name. Generally speaking, it's probably better to use a naming convention to eliminate white space, e.g. USE `StudentRegistration`; or USE `student

Removing Spaces from a String in C?

ⅰ亾dé卋堺 提交于 2019-11-26 16:32:02
What is the easiest and most efficient way to remove spaces from a string in C? Aaron Easiest and most efficient don't usually go together... Here's a possible solution: void remove_spaces(char* s) { const char* d = s; do { while (*d == ' ') { ++d; } } while (*s++ = *d++); } Here's a very compact, but entirely correct version: do while(isspace(*s)) s++; while(*d++ = *s++); And here, just for my amusement, are code-golfed versions that aren't entirely correct, and get commenters upset. If you can risk some undefined behavior, and never have empty strings, you can get rid of the body: while(*(d+

Remove unicode characters from textfiles - sed , other bash/shell methods

点点圈 提交于 2019-11-26 16:16:06
How do I remove unicode characters from a bunch of text files on the terminal? I've tried this but it didn't work: sed 'g/\u'U+200E'//' -i *.txt I need to remove these unicodes from the textfiles U+0091 - sort of weird "control" space U+0092 - same sort of weird "control" space A0 - non-space break U+200E - left to right mark If you want to remove ONLY particular characters and you have python, you can: CHARS=$(python -c 'print u"\u0091\u0092\u00a0\u200E".encode("utf8")') sed 's/['"$CHARS"']//g' < /tmp/utf8_input.txt > /tmp/ascii_output.txt clear all non-ascii chars of file.txt $ iconv -c -f

Converting a sentence string to a string array of words in Java

☆樱花仙子☆ 提交于 2019-11-26 15:34:57
问题 I need my Java program to take a string like: "This is a sample sentence." and turn it into a string array like: {"this","is","a","sample","sentence"} No periods, or punctuation (preferably). By the way, the string input is always one sentence. Is there an easy way to do this that I'm not seeing? Or do we really have to search for spaces a lot and create new strings from the areas between the spaces (which are words)? 回答1: String.split() will do most of what you want. You may then need to

How to run an EXE file in PowerShell with parameters with spaces and quotes

∥☆過路亽.° 提交于 2019-11-26 12:03:48
How do you run the following command in PowerShell? C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql="Data Source=mysource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;" -dest:dbfullsql="Data Source=.\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;",computername=10.10.10.10,username=administrator,password=adminpass" Keith Hill When PowerShell sees a command starting with a string it just evaluates the string, that is, it typically echos it to the screen, for example: PS> "Hello World" Hello World If you want

Runtime.exec on argument containing multiple spaces

。_饼干妹妹 提交于 2019-11-26 11:38:24
问题 Can anyone 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\\\"\"}; //btw this works //String cmd = \"explorer.exe /select,\\\"C:\\\\New Folder\\\\file.txt\\\"\"; //and surprisingly this doesn\'t work //String[] cmd = {\"explorer.exe\", \"/select,\\\"C:\\\\New Folder\\\\file.txt\\\"\"}; //Update: and (as crazy as it seems) the

How to cin Space in c++?

余生颓废 提交于 2019-11-26 11:21:55
Say we have a code: int main() { char a[10]; for(int i = 0; i < 10; i++) { cin>>a[i]; if(a[i] == ' ') cout<<"It is a space!!!"<<endl; } return 0; } How to cin a Space symbol from standard input? If you write space, program ignores! :( Is there any combination of symbols (e.g. '\s' or something like this) that means "Space" that I can use from standard input for my code? It skips all whitespace (spaces, tabs, new lines, etc.) by default. You can either change its behavior, or use a slightly different mechanism. To change its behavior, use the manipulator noskipws , as follows: cin >> noskipws >

How to strip all whitespace from string

百般思念 提交于 2019-11-26 10:07:41
问题 How do I strip all the spaces in a python string? For example, I want a string like strip my spaces to be turned into stripmyspaces , but I cannot seem to accomplish that with strip() : >>> \'strip my spaces\'.strip() \'strip my spaces\' 回答1: Taking advantage of str.split's behavior with no sep parameter: >>> s = " \t foo \n bar " >>> "".join(s.split()) 'foobar' If you just want to remove spaces instead of all whitespace: >>> s.replace(" ", "") '\tfoo\nbar' Premature optimization Even though