special-characters

for name in `ls` and filenames with spaces

给你一囗甜甜゛ 提交于 2019-11-27 08:18:29
next code doesnt work because of spaces in file names, How to fix? IFS = '\n' for name in `ls ` do number=`echo "$name" | grep -o "[0-9]\{1,2\}"` if [[ ! -z "$number" ]]; then mv "$name" "./$number" fi done Just don't use command substitution: use for name in * . Replace for name in `ls` with: ls | while read name Notice : bash variable scoping is awful. If you change a variable inside the loop, it won't take effect outside the loop (in my version it won't, in your version it will). In this example, it doesn't matter. Notice 2 : This works for file names with spaces, but fails for some other

Which are the HTML, and XML, special characters?

随声附和 提交于 2019-11-27 07:36:21
What are the special reserved character entities in HTML and in XML? The information that i have says: HTML: & (replace with & ) < (replace with < ) > (replace with > ) " (replace with " ) ' (replace with &apos; ) XML: < (replace with < ) > (replace with > ) & (replace with & ) ' (replace with &apos; ) " (replace with " ) But i cannot find documentation on either of these. The W3C does mention, in Extensible Markup Language (XML) 1.0 (Fifth Edition) , certain predefined entity references. But it says that these entities are predefined (in the same way that © is predefined); not that they must

Where can I find a list of all special HTML characters? [closed]

大城市里の小女人 提交于 2019-11-27 07:24:10
问题 I'm in the process of adding various physics equations to a website. There are several special characters I've needed to add, and I haven't been able to find some of them (for instance, I need to add a curled "E" to denote energy density, and I need to add an H with the '^' symbol on top to denote the Hamiltonian operator). Thus, I was wondering if anyone has compiled a table of all the various HTML special characters (such as ħ for h-bar, which equals h/2PI). If so, a link would be much

How to prevent automatic escaping of special characters in Python

为君一笑 提交于 2019-11-27 06:48:46
问题 I'm writing a Python script that accepts file paths as strings, parses them, appends a command name, and builds a list, which is then passed to subprocess.Popen() for execution. This script is to handle both Unix and Windows file paths, and ultimately should run on both systems. When I run this under Unix, if I give a Windows path that inadvertently contains an escape character (e.g. \Users\Administrator\bin ), Python will interpret the embedded \b as the backspace character. I want to

Separate string by tab characters

寵の児 提交于 2019-11-27 06:33:57
问题 I have a text file that is tab-delimited. How can I separate this string into substrings for an array by detecting the tabs? 回答1: string s = "123\t456\t789"; string[] split = s.Split('\t'); 回答2: If you use String.split() you can split the String around any regular expression, including tabs. The regex that matches tabs is \t, so you could use the following example; String foo = "Hello\tWorld"; String[] bar = foo.split("\t"); Which would return a String array containing the words Hello and

How do I add a bullet symbol in TextView?

心已入冬 提交于 2019-11-27 06:03:30
I have a TextView and I want to add a bullet symbol in my text through XML. Is it possible? Benny Skogberg You have to use the right character encoding to accomplish this effect. You could try with • Update Just to clarify: use setText("\u2022 Bullet"); to add the bullet programmatically. 0x2022 = 8226 jackbijou This worked for me: <string name="text_with_bullet">Text with a \u2022</string> Copy paste: •. I've done it with other weird characters, such as ◄ and ►. Edit: here 's an example. The two Button s at the bottom have android:text="◄" and "►" . Prolly a better solution out there

Batch file : how to search and replace a string that have an “=” inside

心不动则不痛 提交于 2019-11-27 05:39:12
i have to search a string from a txt like Pippo.K=5 and replace it with Pippo.K=1. I need to search the entire string. What i did is: set "search=Pippo.K=5" set "replace=Pippo.K=1" set "textFile=%SettingFile%.txt" for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do ( set "line=%%i" setlocal enabledelayedexpansion set "line=!line:%search%=%replace%!" >>"%textFile%" echo(!line! endlocal ) but what i returned is 5=Pippo.K=1=5 How can i fix this error? The following script constitutes a pure batch-file solution. Supposing it is stored as repl-str.bat , you need to call it

How to display special characters in PHP

跟風遠走 提交于 2019-11-27 05:17:22
I've seen this asked several times, but not with a good resolution. I have the following string: $string = "<p>Résumé</p>"; I want to print or echo the string, but the output will return <p>R�sum�</p> . So I try htmlspecialchars() or htmlentities() which outputs <p>Résumé<p> and the browser renders <p>Résumé<p> . I want it, obviously, to render this: Résumé And I'm using UTF-8: header("Content-type: text/html; charset=UTF-8"); What am I missing here? Why does echo and print output a � for any special character? To clarify, the string is actually an entire html file stored in a database. The

How to strsplit using '|' character, it behaves unexpectedly?

点点圈 提交于 2019-11-27 04:47:31
问题 I would like to split a string of character at pattern "|" but unlist(strsplit("I am | very smart", " | ")) [1] "I" "am" "|" "very" "smart" or gsub(pattern="|", replacement="*", x="I am | very smart") [1] "*I* *a*m* *|* *v*e*r*y* *s*m*a*r*t*" 回答1: The problem is that by default strsplit interprets " | " as a regular expression, in which | has special meaning (as "or"). Use fixed argument: unlist(strsplit("I am | very smart", " | ", fixed=TRUE)) # [1] "I am" "very smart" Side effect is faster

How to convert special characters to normal characters?

半城伤御伤魂 提交于 2019-11-27 04:44:04
问题 I am trying to convert characters like: ë, ä, ï, ö, etc. To normal characters like: e, a, i, o, etc. What is the best way to do this? I've tried many things, like preg_replace and str_replace. Can someone help me out? -- EDIT -- What I tried, was: $ts = array("[À-Å]","Æ","Ç","[È-Ë]","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/"); $tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a",