spaces

Convert spaces to tabs

别说谁变了你拦得住时间么 提交于 2019-11-28 15:12:59
问题 I'm writing TypeScript and HTML files, and tabs gets converted to spaces. In my TypeScript project, every tab converts to spaces, I want to turn it off, and have a tab instead of spaces. This is my settings: { "editor.insertSpaces": false } EDIT 1: It seems to work in .html files, but not in .ts files. 回答1: There are 3 options in .vscode/settings.json : // The number of spaces a tab is equal to. "editor.tabSize": 4, // Insert spaces when pressing Tab. "editor.insertSpaces": true, // When

How can I convert spaces to tabs in Vim or Linux?

流过昼夜 提交于 2019-11-28 14:55:45
I've looked over several questions on Stack Overflow for how to convert spaces to tabs without finding what I need. There seem to be more questions about how to convert tabs to spaces, but I'm trying to do the opposite. In Vim I've tried :retab and :retab! without luck, but I believe those are actually for going from tabs to spaces anyways. I tried both expand and unexpand at the command prompt without any luck. Here is the file in question: http://gdata-python-client.googlecode.com/hg-history/a9ed9edefd61a0ba0e18c43e448472051821003a/samples/docs/docs_v3_example.py How can I convert leading

validating textbox in windows form applications

只谈情不闲聊 提交于 2019-11-28 14:52:47
My scenario is: Not allowing spaces at starting position of textbox after enter one or more characters text box allows spaces Below not applicable to my scenario. private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.Handled = (e.KeyChar == (char)Keys.Space)) { MessageBox.Show("Spaces are not allowed"); } } textBox1.Text.TrimStart() private void textBox1_KeyPress(object sender, KeyPressEventArgs e) \ { if(textBox1.Text.Length == 0) { if (e.Handled = (e.KeyChar == (char)Keys.Space)) { MessageBox.Show("Spaces are not allowed at start"); } } } I believe that lazyDBA's answer

How replace all spaces inside HTML elements with   using preg_replace?

馋奶兔 提交于 2019-11-28 12:25:42
I need replace spaces with   inside HTML elements. Example: <table atrr="zxzx"><tr> <td>adfa a adfadfaf></td><td><br /> dfa dfa</td> </tr></table> should become <table atrr="zxzx"><tr> <td>adfa a   adfadfaf></td><td><br /> dfa  dfa</td> </tr></table> n00b use regex to catch data between tags (?:<\/?\w+)(?:\s+\w+(?:\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+)?)+\s*|\s*)\/?>([^<]*)? then replace ' ' with ' ' also to catch before and after html : ^([^<>]*)<? >([^<>]*)$ Edit: here you go.... <?php $data="dasdad asd a <table atrr=\"zxzx\"><tr><td>adfa a adfadfaf></td><td><br /> dfa dfa</td></tr></table>

Listing files in date order with spaces in filenames

房东的猫 提交于 2019-11-28 11:50:22
I am starting with a file containing a list of hundreds of files (full paths) in a random order. I would like to list the details of the ten latest files in that list. This is my naive attempt: $ ls -las -t `cat list-of-files.txt` | head -10 That works, so long as none of the files have spaces in, but fails if they do as those files are split up at the spaces and treated as separate files. File "hello world" gives me: ls: hello: No such file or directory ls: world: No such file or directory I have tried quoting the files in the original list-of-files file, but the here-document still splits

Spaces between html attributes and values?

风格不统一 提交于 2019-11-28 10:03:05
Are they allowed? and do they work with all browsers? Example: <div role = "region" id = "some-id" class = "a-class another-class"> Yes, any amount of whitespace is allowed and will work in all browsers. One consideration - this will add to the page size, so if bandwidth and performance are concerns, try to limit the amount of whitespace you use. Yes, it is perfectly valid markup. Whitespace is handled nicely by all browsers. Any time you have confusion, you can validate your code at official W3 validation service : http://validator.w3.org/ Yes they are, and they will work in all major

Forcing emacs to use the tab character instead of a number of spaces

落爺英雄遲暮 提交于 2019-11-28 09:59:04
问题 I recently ran into some trouble with cron and crontab because the text editor I use, emacs , inserts several spaces instead of a tab, when I press the tab key. This issue persists throughout all the major modes, regardless of the tab width set for each mode. How can emacs be forced to use the tab character instead of tabs composed of multiple spaces? 回答1: If you want to insert a TAB character, then use C-q TAB . The TAB key is used for a different purpose (mostly to indent/align text/code

How can I programmatically move one Terminal.app window to another space?

故事扮演 提交于 2019-11-28 06:32:28
If I have several OS-X Terminal.app windows open, how can I move one Terminal window to another space? I'm happy to use any scripting or programming language to achieve this, but would prefer AppleScript or calls to standard frameworks. (Note this is to move only one window of an application not all windows .) Using private calls in Objective-C/C, unofficially listed here #import <Foundation/Foundation.h> typedef int CGSConnection; typedef int CGSWindow; extern OSStatus CGSMoveWorkspaceWindowList(const CGSConnection connection, CGSWindow *wids, int count, int toWorkspace); extern CGSConnection

Trim leading spaces including tabs

雨燕双飞 提交于 2019-11-28 04:31:14
问题 I need to read files using vbscript and remove all leading spaces including any tabs. I now LTRIM will remove the leading spaces but how do I remove tabs also. Thanks. 回答1: This function removes all leading whitespace (spaces, tabs etc) from a string: Function LTrimEx(str) Dim re Set re = New RegExp re.Pattern = "^\s*" re.Multiline = False LTrimEx = re.Replace(str, "") End Function 回答2: For a both left and right trim (including tabs, carriage return, line feeds, spaces) in a multiline string

using fstream to read every character including spaces and newline

…衆ロ難τιáo~ 提交于 2019-11-28 04:22:34
I wanted to use fstream to read a txt file. I am using inFile >> characterToConvert , but the problem is that this omits any spaces and newline. I am writing an encryption program so I need to include the spaces and newlines. What would be the proper way to go about accomplishing this? Jason Etheridge Probably the best way is to read the entire file's contents into a string, which can be done very easily using ifstream's rdbuf() method: std::ifstream in("myfile"); std::stringstream buffer; buffer << in.rdbuf(); std::string contents(buffer.str()); You can then use regular string manipulation