w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can I replace single  's with a space but, not if there are multiple  s?
You must use a negative lookbehind and a negative lookahead to ensure that you don't have other &nbsp; around. $str = preg_replace('~(?<!&nbsp;)&nbsp;(?!&nbsp;)~i', ' ', $str); More informations about lookarounds here.

Categories : PHP

When to use  
&nbsp; (it should have a semi-colon on the end) is an entity for a non-breaking space. Use it between two words that should not have a line break inserted between them by word wrapping. There is a good explanation about when this is appropriate grammar on the English StackExchange. It is sometimes abused to create horizontal space between content in web pages (since it will not collapse like multiple regular spaces). Padding and margins should usually be used instead of this hack.

Categories : HTML

How can I put a   into the content with xom
I suggest you don't use toXML() but use nu.xom.Serializer which normally gives explicit numeric entity references. Serializer should give an explicit numeric entity reference (&#160;). If you really need &nbsp; you may have to subclass Serializer and override the Text methods. To use Serializer try: OutputStream out = new FileOutputStream(file); Serializer ser = new Serializer(out); ser.write(doc); out.close(); if you have to subclass Serializer it gets more tricky.

Categories : Java

Why 'a' convert to  
Your code is probably using strip_tags() to remove the tags from the actual HTML. You can use html_entity_decode to bring back it to its original form. Example: <?php $link = '<a href="dakjhd">text</a>'; $a = strip_tags($link); $b = htmlentities($link); $c = html_entity_decode($b); echo $a; // output: text echo $b; //output: <a href="dakjhd">text</a> echo $c; //output: the actual link ?> Hope that clears your doubt!

Categories : PHP

  and on PHP email issue
It is most likely an encoding issue. Possibly the setting on the editor you are using is saving the text in some encoding that is not recognized. I have had similar issues using notepad++ and not thinking about encoding.

Categories : PHP

Can a   have a CSS font-size?
There's no need to put something into a button to give it a size. Here's how you can give a button a 20x20 size : HTML : <button id=a></button> CSS : #a { weight:20px; height:20px; } Demonstration

Categories : HTML

how to extract all the data between  
You can do that with BeautifulSoup: from bs4 import BeautifulSoup s = "" html = '<p align="JUSTIFY">I </p> <p align="JUSTIFY"> have a question </p> <p align="JUSTIFY">&nbsp;</p> <p align="JUSTIFY">The </p> <p align="JUSTIFY">answer is</p> <p align="JUSTIFY">not there</p> <p align="JUSTIFY">&nbsp;</p> <p align="JUSTIFY">Please</p> <p align="JUSTIFY">Help</p>' soup = BeautifulSoup(html) title = soup.findAll("p", {"align" : "JUSTIFY"}) for i in title: s += ''.join(i.contents) f = s.split("&nbsp;") for i in f: print i

Categories : Python

How to filter out ' ' in jQuery?
You could trim the string representation: if ($('td').text().trim() == ""){ //do something... } Admittedly, I'm making the rather bold assumption here that in general you don't want any table cell elements devoid of text, regardless of whether this is a case of <td> </td> or <td><span></span></td>. If the second example is a false positive for your purposes, you can use a stricter version, like so: var td = $('td'); if ((td.children().length == 0) && td.text().trim() == ""){ //do something... } This ensures the td is not considered a match if it has nodes other than text nodes, regardless of whether it is devoid of text.

Categories : Jquery

How to deal with   when using Nokogiri
First, don't use search unless you want a NodeSet returned. A NodeSet acts like an array of Nodes, so you have to be prepared to iterate over them, or you can get some really weird results. Instead, start with something like this: require 'nokogiri' doc = Nokogiri::HTML(<<EOT) <div class="total_count"> <b>Returned:</b>&nbsp;97&nbsp;results </div> EOT doc.at('div').text.scan(/d+/) # => ["97"] doc.at('div').text[/d+/] # => "97" at returns the first node matching the selector. In this case it's the <div>. I can use class selectors too: doc.at('.total_count').text[/d+/] # => "97" Next, instead of trying to use gsub to remove what you don't want, use a regular expression to match what you DO want. I repeatedly see code that gets

Categories : Ruby

simple_form collection and   in name
I fix it, but this html_safe makes me confused all the time :(. In helper: out.map {|b| b.name = "#{"&nbsp;"*b.depth}#{b.name}";b} Should be: out.map {|b| b.name = "#{"&nbsp;"*b.depth}#{b.name}".html_safe;b}

Categories : Ruby On Rails

converting apple-tab-space into  
Try this (replace "myDiv" with a selector for the actual div you're targeting): $('#myDiv').html(function() { return this.innerHTML.replace(/ /g, '&nbsp;'); }); I pulled this code snippet from this answer: Replacing tab characters in JavaScript

Categories : Javascript

CSS property: -webkit-nbsp-mode
No, and it will be removed in Blink (the rendering engine used by Chrome and Opera) some time in the future: http://code.google.com/p/chromium/issues/detail?id=227311

Categories : CSS

XHTML and   doesnt work?
Some XHTML configurations don't seem to have the full list of entity names. Use the numerical character reference, &#160; Edit: "Some XHTML configurations" means XHTML documents without a full XHML DOCTYPE declaration. If you omit the DOCTYPE altogether, or use a shorthand one, like <!DOCTYPE html>, the browser will only recognise the five XML entity names. So either provide a full DOCTYPE, like <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> or use numerical character references as above.

Categories : HTML

How to write out HTML entity name ( , <, >, etc)
You will need to write out a part of the code, in this example, I'll use the ampersand. Instead of writing &nbsp;, write out the ampersand, &amp;, and then write nbsp;. Your final result should be &amp;nbsp;, which will display &nbsp; on the webpage.

Categories : HTML

Weird nbsp; issue in my html.
The file is probably saved in a character encoding that uses multiple bytes to encode ampersands. When the ipad reads it it's probably decoding using a different character encoding. Make sure that the encoding you're saving in matches your <meta charset>. MDN Link Alternatively, if you can, save your original document in UTF-8, which is usually a good bet for a compatible default encoding.

Categories : HTML

replace   & © and another ISO-8859-1 by regex in php
Drop the initial ^. You want to match anywhere in the string, not just the start of the string. preg_replace('/&+(w)+;/', '--', $string); → string(21) "one--two--three--four"

Categories : PHP

Imperavi Redactor 9 removes   ; character
The text and code you are seeing will be different between all the browsers and it's how contenteditable fields work. For example, some browsers insert UTF-8 characters for spaces some &nbsp. RedactorJS don't gives methods to normalize the text, so you can parse the text manually. Check this: var html = $('#redactor').redactor('get'); var sanitizeHtml = html.replace(/u00a0/g, ' ').replace(/&nbsp;/g, ' ');

Categories : Misc

Ckeditor 4 - removing nbsp; and

after paste from Word
Figured it out after a lot of debugging. The approach in the question was actually spot on, but I mistakenly assumed the JS replace function did a global replace. So what was happening was only the first instances were being removed. Here is the amended version that uses regex style syntax, replacing globally: CKEDITOR.on('instanceReady', function(ev) { ev.editor.on('paste', function(evt) { evt.data.dataValue = evt.data.dataValue.replace(/&nbsp;/g,''); evt.data.dataValue = evt.data.dataValue.replace(/<p></p>/g,''); console.log(evt.data.dataValue); }, null, null, 9); });

Categories : Javascript

replace semicolon (;) but not html characters (  etc.)
If you must use the regular expression, you can step like this: remove all character, except w : ; & replace all &copy; to @@@copy### you can replace the : ; with <td> now replace all @@@copy### to &copy; remove all &nbsp;

Categories : PHP

  HTML markup renders not as expected
Not sure why you would need two-way databinding on a label, so I would probably go back to using something like the following: <%--Content--%> <p> <asp:Literal ID="lblContent" runat="server" Text='<%# System.Web.HttpUtility.HtmlEncode((string)Eval("content")) %>' /> </p>

Categories : HTML

How do I remove an entry from List> based on just the key?
Use List.RemoveAll. You can pass in a predicate which checks the key value. Example: myList.RemoveAll(kvp => kvp.Key == "@index");

Categories : C#

Need help writing a regex string to remove string with variable number
Include a pattern delimiter (in this case ~): $string = preg_replace('~::tt::[0-9]+::/tt::~', '', $string );

Categories : PHP

serialize Dictionary and remove key/value from json string
Its because you are using dictionary for storing the value. You have to write a custom implementation and overide serialization/deserialization methods Look here for more details

Categories : C#

Remove everything from a string upto a certain character and optionally a string if it follows too
Try this: String removeEmsp =" &ldquo;[<centd>[</centd>]&sect;&ensp;431:10A&ndash;126&emsp;(new section)[<centd>]Chemotherapy services.</centd>] <centa>Cancer treatment.</centa>test snl."; System.out.println(removeEmsp.replaceFirst("^.*?\&emsp;(\(new\ssection\))?", "")); System.out.println(removeEmsp.replaceAll("^.*?\&emsp;(\(new\ssection\))?", "")); Output: [<centd>]Chemotherapy services.</centd>] <centa>Cancer treatment.</centa>test snl. [<centd>]Chemotherapy services.</centd>] <centa>Cancer treatment.</centa>test snl. It will remove everything up to "&emsp;" and optionally, the following "(new section)" text if any.

Categories : Java

Preserve non-break space   in jQuery trim function
Replace all white spaces with blank. var dest = 'test value'; result_val=dest.split(" ").join(""); demo

Categories : Javascript

Textarea not accepting   and & whille saving pages content using ajax and php
This happen because of url encode. You should use encodeURIComponent() on your JavaScript params. change var x = $("textarea").val(); to var x = encodeURIComponent($("textarea").val()); also your script can be simplified <script> $(function (){ $("#x").click(function (){ $.ajax({ type: 'POST', url: 'save.php', data: { c: encodeURIComponent($("textarea").val())} success: function(e){ $("#s").html(e); } }); }); }); </script> change input to <input id="x" type="button" value="Save"> You should also stay to html standard. In this example it'll be good to bind event to submit form event and use <form> tag.

Categories : PHP

I want to remove all charactors from string /integer from string in php
Try this : $string='Tel. 040- 36 49 03 SEC'; echo preg_replace("/[A-Za-z]+/","",$string); Do you want to remove . and - also ? echo preg_replace("/[A-Za-z-. ]+/","",$string); // this will just give you number, removes all characters

Categories : PHP

Remove/Count spaces in a string (using the same string)
1) Last spaces don't be cut too. Add check and action after loop. 2) I recommend to divide notions of local space counter and global space counter. unsigned int contEsp = 0; unsigned int i = 0; unsigned int localEsp = 0; while(str[i] != ''){ if(str[i] == ' '){ contEsp += 1; localEsp += 1; }else if(contEsp) { strcpy(&str[i - localEsp], &str[i]); localEsp = 0; continue; } i++; } if ( localEsp > 0 ) strcpy(&str[i - contEsp], &str[i]);

Categories : C

how to remove specific String from String in java
I suspect that 2005:0.056 Top Terms: Weight : is actually a single line ... somehow. That regex should (only) match lines where you have a "word" consisting of a single digit. I'm guess that you actually know this (and you "forgot to mention it"). If you want to match these: 2005:0.056 15th:0.023 1st:0.023 2nd:0.023 3rd:0.023 but not these: 2005:0.056 Top Terms: Weight : 1.0: then you need a stricter regex, and match() rather than find; e.g. pattern = Pattern.compile( "\s*[0-9]+(st|nd|rd|th|(\.[0-9]+))?:[0-9]+\.[0-9]+\s*"); for (String t1: Result) { matcher = pattern.matcher(t1); if (matcher.match()) { System.out.println(t1); } } But at this point I'm guessing what your actual criterion for a "valid" line is.

Categories : Java

I am trying to remove characters in a string from a defined string. the error comes here: if(s.charAt(x) == punct.charAt(y))
I'm a smidge drunk, but it looks like you check the length of your string at the beginning of the loop, then you start removing characters from it, and your loop overruns the end of the string. You need a while loop I think, so you can check that your index is within bounds before every iteration. int x = 0; while(x < s.length()) { for(int y = 0; y < punct.length(); y++) { if(s.charAt(x) == punct.charAt(y)) { s = s.replace("" + s.charAt(x), ""); } } x++; } It's ugly cause I'm on a tablet, but I think it works.

Categories : Java

cut a string from right side to maximal 25 chars even when string is less than 25 chars, remove newlines of all kinds
It seems, that there's no ready function in a framework, but you can do something like this: public static String Preview(String value) { String[] newLines = new String[] { "<br>", "<br />", " ", " ", Environment.NewLine }; foreach (String newLine in newLines) value = value.Replace(newLine, ""); // <- May be space will be better here if (text.Length > 25) return value.Substring(0, 25) + "…"; // If you want string END, not string START, comment out the line above and uncomment this // return value.Substring(value.Length - 25) + "…"; else return value; } ... // Test sample String text = "abcd<br>efgh 1234567890zxy 1234567890abc"; String result = Preview(text); // <- abcdefgh1234567890zxy1234

Categories : C#

Remove or from a given string
It looks like you also want to remove spaces. You can do something like this, >>> import re >>> s = "abc efg" >>> s = re.sub('s+', '', s) >>> s 'abcefg' Another way would be to do, >>> s = "abc efg" >>> s = s.translate(None, ' ') >>> s 'abcefg'

Categories : Python

Remove everything between ? and # in string
Using regular expressions: var s = 'http://localhost:8080/Test/index.html?node=station:|slot:/gooberVille/Neverland/Hola#/overview/standard'; s = s.replace(/?.*?#/, ''); ? is a special character in regular expressions, so to match a literal ? you escape it with a backslash. . matches any character, .* matches any number of any character (as many as possible), and .*? matches any number of any character (as few as possible). So /?.*?#/ will match starting from the first ?, then as few characters as possible until a # is found. By replacing a match of this regex with an empty string you get the result you want. If you want to keep the # in the string, just change it to s.replace(/?.*?#/, '#').

Categories : Javascript

Remove � from string
You can remove � as follows. may be issue with character encoding. It has Unicode value 0xFFFD String returnStr="[��BMW 320d Xdrive, 222201176��]"; System.out.println(returnStr.replaceAll("\[|\]|\�",""));

Categories : Java

Remove a string from php
You could simply do it in two steps: <?php $lang = str_replace('en', '', substr(JFactory::getLanguage()->getTag(), 0, 2)); $url = 'http://www.mysite.com/'.$lang.'/pages.html'; $url = str_replace('//', '/', $url); ?> <link rel="canonical" href="<?php echo $url; ?>" />

Categories : PHP

How to remove a used string
You have to rewrite the entire file: Dim newLines = File.ReadAllLines(path). .Where(Function(l) Not l.Trim.Equals(stN, StringComparison.OrdinalIgnoreCase) ) File.WriteAllLines(path, newLines) If you don't want to use Trim and the case insensitive comparison: .Where(Function(l) l <> stN) Edit: Are you using .NET 3.5? Then File.WriteAllLines does not accept an IEnumerable(Of String) but only String(). You need to create one from the query: File.WriteAllLInes(path, newLines.ToArray())

Categories : Vb.Net

How do you remove from a string?
Try This. NSString *string = @"Whats Going on "; NSString *result = [string stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; or the simple way as we used to replace a particuler string into string. like string = [string stringByReplacingOccurrencesOfString:@" " withString:@" "];

Categories : Objective C

Remove tags in string
Use String.Replace to replace commas with empty strings. Dim movieData as String = "{""Title"":""True Grit"",""Year"":""1969""}" movieData = movieData.Replace(",", "")

Categories : Vb.Net

PHP remove timestamp from string
you could use a simple explode or as noted in the comments substr but if you don't know how the string will be formatted a more complex date('Y-m-d', strtotime($mytime)) based on your updated post... $newdate = substr($olddate,0,10);

Categories : PHP

Remove all elements if contain a string
The problem is, when you remove an item, you change the collection's indexing (ie, the item at i=1 moves to 0). To correct this, iterate backwards: for (i = elemItem.length-1; i >= 0 ; i--) {

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.