removing-whitespace

How to remove trailing whitespaces for multiple files?

删除回忆录丶 提交于 2019-11-28 15:57:32
Are there any tools / UNIX single liners which would remove trailing whitespaces for multiple files in-place . E.g. one that could be used in the conjunction with find . You want sed --in-place 's/[[:space:]]\+$//' file That will delete all POSIX standard defined whitespace characters, including vertical tab and form feed. Also, it will only do a replacement if the trailing whitespace actually exists, unlike the other answers that use the zero or more matcher ( * ). --in-place is simply the long form of -i . I prefer to use the long form in scripts because it tends to be more illustrative of

Oracle trim whitespace on the inside of a string

我的梦境 提交于 2019-11-28 11:13:42
I am storing phone numbers as VARCHAR2 in my system to allow for users to input '+' characters infront of their phone number if they so choose. My regexp allows for this perfectly, but when storing the number in the database I want to strip out all whitespace the user may enter. My regexp allows for the following formats +4470123456789 +447 0123456789 +447 01234 56789 01234567890 01234 567890 01234 567 890 I know I could resolve my issue by not letting users put any whitespace in their numbers, but I know from personal experience just how frustrating it is to have a validation error due to

Atom text editor remove trailing whitespace on save

ぐ巨炮叔叔 提交于 2019-11-28 04:14:38
I use Sublime text . Now I am trying Atom . When I save any file in sublime text it does not include any trailing blank line. But saving any file in Atom leaves a trailing blank line. How do I force Atom not to leave trailing white spaces? Under your Atom Preferences go to Packages tab and search for whitespace . Click on the whitespace package and uncheck Ensure Single Trailing Newline option On global level this can be changed using settings in Whitespace package, but if you want to disable it for a specific language you have to use syntax-scoped properties in your config.cson. '.text.html

Trim trailing spaces with PostgreSQL

泪湿孤枕 提交于 2019-11-28 03:57:48
I have a column eventDate which contains trailing spaces. I am trying to remove them with the PostgreSQL function TRIM() . More specifically, I am running: SELECT TRIM(both ' ' from eventDate) FROM EventDates; However, the trailing spaces don't go away. Furthermore, when I try and trim another character from the date (such as a number), it doesn't trim either. If I'm reading the manual correctly this should work. Any thoughts? There are many different invisible characters. Many of them have the property WSpace=Y ("whitespace") in Unicode. But some special characters are not considered

Why is there a pesky little space between <img> and other elements?

假装没事ソ 提交于 2019-11-28 00:04:18
If a <div> or any other element follows an <img> , then a ~3px whitespace appears in between them — even if margins are zero'd. <img src="example-fractal-art.png"> <div>What is with that gap?<div> Here's what it looks like with some CSS . Now it's pretty easy to throw in display: block into the CSS and solve the problem . But why is it there? There are no computed margins, padding, borders, or anything like that. What are the browsers doing? Someone even called it "magic" . P.S. Alternatively, in some cases, it is possible to solve this by removing whitespace in the HTML code. (But that doesn

How do I split a string by whitespace and ignoring leading and trailing whitespace into an array of words using a regular expression?

点点圈 提交于 2019-11-27 20:20:49
I typically use the following code in JavaScript to split a string by whitespace. "The quick brown fox jumps over the lazy dog.".split(/\s+/); // ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog."] This of course works even when there are multiple whitespace characters between words. "The quick brown fox jumps over the lazy dog.".split(/\s+/); // ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog."] The problem is when I have a string that has leading or trailing whitespace in which case the resulting array of strings will include an empty character at

How can I eliminate spacing between inline elements in CSS? [duplicate]

这一生的挚爱 提交于 2019-11-27 20:02:57
This question already has an answer here: How do I remove the space between inline-block elements? 37 answers I have a div with a bunch of image tags inside, here is an example: <div style="margin: 0; padding: 0; border: 0;"> <a href="/view/foo1"><img src="foo1.jpg" alt="Foo1" /></a> <a href="/view/foo2"><img src="foo2.jpg" alt="Foo2" /></a> <a href="/view/foo3"><img src="foo3.jpg" alt="Foo3" /></a> </div> Because there is whitespace between the tags, browsers will display some whitespace between the images (Chrome decides on 4px). How can I tell the browser to show NO whitespace whatsoever

git remove trailing whitespace in new files before commit

限于喜欢 提交于 2019-11-27 19:30:59
I know removing trailing whitespace can be done with a pre-commit hook. I am interested in doing it manually. I read the question here: Make git automatically remove trailing whitespace before committing - Stack Overflow The answer closest to what I want is the "automatic version" from ntc2 : (export VISUAL=: && git -c apply.whitespace=fix add -ue .) && git checkout . && git reset That command works well except it seems to be only for changes on files that are already in the repo, not new files. I have a bunch of files that are new, meaning they aren't yet in the repo. I want to remove

c# Fastest way to remove extra white spaces

﹥>﹥吖頭↗ 提交于 2019-11-27 18:58:18
What is the fastest way to replace extra white spaces to one white space? e.g. from foo bar to foo bar Blindy The fastest way? Iterate over the string and build a second copy in a StringBuilder character by character, only copying one space for each group of spaces. The easier to type Replace variants will create a bucket load of extra strings (or waste time building the regex DFA). Edit with comparison results: Using http://ideone.com/NV6EzU , with n=50 (had to reduce it on ideone because it took so long they had to kill my process), I get: Regex: 7771ms. Stringbuilder: 894ms. Which is indeed

My diff contains trailing whitespace - how to get rid of it?

情到浓时终转凉″ 提交于 2019-11-27 15:30:47
问题 I've tried editing a php file in TextWrangler with line endings set to Unix, in NetBeans, and in vim. When I save the diff to a patch and then try to apply it, it gives whitespace errors. When I type git diff I can see ^M at the ends of my lines, but if I manually remove these in vim, it says my patch file is corrupted, and then the patch doesn't apply at all. I create a patch with the following command: git diff > patchname.patch And I apply it by checking out a clean version of the file to