Questions tagged [backslash]

The backslash character \ (not to be confused with slash /) is used in many languages as an escape character to modify the meaning of the following character. It is also the directory separator in file paths under DOS and Windows.

The backslash character \ is a mirror version of the slash character /, created for use in computing. Its meaning depends on the context.

  • In many languages, \ followed by a character that has a special meaning makes the next character lose its special meaning. This is especially true inside string literals and regular expressions : for example, in many languages, "a\\b\"" represents the 4-character string a\b".
  • Sometimes \ gives the next character a special meaning. This is mostly the case when \ is followed by a letter or digit in a string literal, where it can be used to specify a control character or other special character. For example, \n specifies a newline in many languages, and \123 often specifies the character whose octal value is 123 (but note that some languages have different rules).
  • In DOS and Windows , the \ character is the directory (folder) separator in file paths. For example, c:\windows\cmd.exe is the file called cmd.exe in the directory called windows at the root of the c: drive.
  • In (La)TeX , \ starts a command name.
  • In Haskell , \ introduces a lambda expression .
991 questions
-3
votes
1 answer

Need examples of strings with backslash in before PHP 5.1.1 version and in PHP 7.2.6 version

I come across following sentence in PHP Manual As in single quoted strings, escaping any other character will result in the backslash being printed too. Before PHP 5.1.1, the backslash in \{$var} had not been printed. I want the examples of…
PHPLover
  • 1
  • 51
  • 158
  • 311
-3
votes
1 answer
-3
votes
2 answers

Remove backslash in Javascript array

I have the following array: […
PhilG
  • 351
  • 1
  • 4
  • 15
-3
votes
2 answers

Assign '\' to char

How do I assign the value of '\' to a character variable? C++ doesn't recognize the backslash as a character and thinks there should be a 't' or 'n' or something afterwards. How can the \ be assigned to a char variable?
Noa Vidović
  • 17
  • 1
  • 2
-3
votes
2 answers

Backslash Escape Character

myInt = parseInt(myString, 10); document.write("\"" + myString + "\" when converted to an integer equals " + myInt + "
"); Having trouble getting a full understanding of the backslash escape character. For example, the above code…
Alfonso Giron
  • 279
  • 4
  • 11
-3
votes
3 answers

How to remove \ (backslash) from link?

How to remove \ from links I got from scraping. Example: https:\\/\\/graph.facebook.com\\/v1.0\\/159463177547058\\/photos?fields=source\u00252Cname&limit=100&after=MjA4MTA5NTMyNjgyNDIy Is there any way?
-3
votes
5 answers

echo a form input with backslashes

trying to get the html code working by using echo, this works as html: but when I escape the value with backslash ( i have…
botch
  • 15
  • 5
-4
votes
2 answers

Iterating over Unicode Characters

I wanted to loop over Unicode-Characters in Python like this: hex_list = "012346789abcdef" for _1 in hex_list: for _2 in hex_list: for _3 in hex_list: for _4 in hex_list: my_char = r"\u" + _1 + _2 + _3 + _4 …
-4
votes
1 answer

How can I remove \ (backslash)?

I use gin web framework and this is data in redis [ { "Score": 12, "Member": "{"empname":"DDDDDDDD","empid":20}" }, { "Score": 5, "Member": "{"empname":"Dixya Lhyaho","empid":10}" } ] after fetch from redis , why return…
Stality
  • 7
  • 1
-4
votes
2 answers

Adding quotes to the array of values

I have an array of strings. I need to add slashes to the array of values dynamically. How can I do this in JavaScript? Input: ["opera","admatic"] Expected Output: ["\"opera\"","\"admatic\""]
HPLion
  • 13
  • 1
  • 7
-4
votes
2 answers

Removing backslash from date()

I'm trying to convert SQL datetime to a Y/m/d G:i:s format. It has formated, but there is an extra backslash in front of every frontslash... I've tried str_replace and stripslashes and non of them have worked... Data:…
Lofty
  • 5
  • 2
-4
votes
2 answers

Backslash in Python 3

I just started to learn python3 2 or 3 days ago so I'm a total noob. I'm learning from a book called How to think like a computer scientist and it uses python2 ann not python3 ... I got stuck when it told me about backslash character... and i can't…
Eeren
  • 3
  • 3
-4
votes
3 answers

How to print a backslash (\) at the beginning of a string (c#)

I have got the string: string test = "\test.xml"; how can I print it out as: \test.xml
kimliv
  • 427
  • 1
  • 8
  • 25
-5
votes
1 answer

Why does Visual Studio replaces my slash with a backslash?

In my project I save xml-files to a folder. The variable "header" contains the name of the file. string header = "anyString"; The line to save the file…
MarcSchaetz
  • 484
  • 4
  • 11
-8
votes
2 answers

How to find the substring \' in string, PHP

I need to find all the \' from a string, and replace them with something else. I'm using PHP. Example: if I wanted to replace them with 4s, the original string would be \b\fs\'80.\b And the new one \b\fs480.\b Can anyone help? Thanks everybody.
Pottercomuneo
  • 718
  • 1
  • 6
  • 10
1 2 3
65
66