Mysterious whitespace in between Bootstrap2 Navbar and row underneath

You may want to override the margin-bottom: 20px from navbar : .navbar { margin-bottom: 0; } Something like that : http://jsfiddle.net/q4M2G/ (the !important is here just to override the style of the CDN version of bootstrap I’m using in the jsfiddle but you should not need to use it if your style correctly overrides bootstrap … Read more

How to remove leading and trailing white spaces from a given html string?

See the String method trim() – https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim var myString = ‘ bunch of <br> string data with<p>trailing</p> and leading space ‘; myString = myString.trim(); // or myString = String.trim(myString); Edit As noted in other comments, it is possible to use the regex approach. The trim method is effectively just an alias for a regex: if(!String.prototype.trim) … Read more

Trim trailing spaces with PostgreSQL

There are many different invisible characters. Many of them have the property WSpace=Y (“whitespace”) in Unicode. But some special characters are not considered “whitespace” and still have no visible representation. The excellent Wikipedia articles about space (punctuation) and whitespace characters should give you an idea. <rant>Unicode sucks in this regard: introducing lots of exotic characters … Read more

How to remove whitespace from right end of NSString?

UPDATE: A quick benchmark showed that Matt’s own adaption, based on Max’ & mine, performs best. @implementation NSString (TrimmingAdditions) – (NSString *)stringByTrimmingLeadingCharactersInSet:(NSCharacterSet *)characterSet { NSUInteger location = 0; NSUInteger length = [self length]; unichar charBuffer[length]; [self getCharacters:charBuffer]; for (location; location < length; location++) { if (![characterSet characterIsMember:charBuffer[location]]) { break; } } return [self substringWithRange:NSMakeRange(location, length … Read more

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

If you are more interested in the bits that are not whitespace, you can match the non-whitespace instead of splitting on whitespace. ” The quick brown fox jumps over the lazy dog. “.match(/\S+/g); Note that the following returns null: ” “.match(/\S+/g) So the best pattern to learn is: str.match(/\S+/g) || []