Questions tagged [dollar-sign]

Anything related to the dollar symbol `$` and its special meanings in programming. The dollar symbol is often used in various programming languages as a special symbol for various purposes.

Anything related to the dollar symbol $ and its special meanings in programming. The dollar symbol is often used in various programming languages as a special symbol for various purposes.

For example, the dollar symbol has special meaning in:

  • most flavors of regular expressions
  • PHP language
  • R language
  • some Basic dialects
  • BASH shell language
  • assembly language
  • makefiles language
  • TCL language
  • etc.
199 questions
23
votes
3 answers

Why $'\0' or $'\x0' is an empty string? Should be the null-character, isn't it?

bash allows $'string' expansion. My man bash says: Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if…
oHo
  • 51,447
  • 27
  • 165
  • 200
19
votes
3 answers

How to escape dollar sign ($) in a string using perl regex

I'm trying to escape several special characters in a given string using perl regex. It works fine for all characters except for the dollar sign. I tried the following: my %special_characters; $special_characters{"_"} =…
Tom Winter
  • 307
  • 1
  • 3
  • 8
19
votes
4 answers

How to echo a variable containing an unescaped dollar sign in bash

If I have a variable containing an unescaped dollar sign, is there any way I can echo the entire contents of the variable? For example something calls a script: ./script.sh "test1$test2" and then if I want to use the parameter it gets "truncated"…
Not22
  • 305
  • 1
  • 4
  • 7
16
votes
2 answers

What does the dollar sign mean inside an attribute selector in jQuery?

There is this jQuery which seems to look for all elements with id="scuba", but then it uses attr() to pull the id out? Could "scuba" be part of the id and attr pulls the entire id out? I've never seen the $ inside an attribute selector, just outside…
Bradley Oesch
  • 763
  • 10
  • 22
15
votes
5 answers

What does the $ mean when running commands?

I've been learning Python, and I keep running into the $ character in online documentation. Usually it goes something like this: $ python ez_setup.py (Yeah, I've been trying to install setup tools) I'm fairly certain that this command isn't for the…
joshpaulchan
  • 183
  • 1
  • 1
  • 7
14
votes
2 answers

Dollar operator as function argument for sapply not working as expected

I have the following list test_list=list(list(a=1,b=2),list(a=3,b=4)) and I want to extract all elements with list element name a. I can do this via sapply(test_list,`[[`,"a") which gives me the correct result #[1] 1 3 When I try the same with Rs…
cryo111
  • 4,444
  • 1
  • 15
  • 37
12
votes
4 answers

Haskell dollar operator application

I'm having trouble with understanding how function application works with currying in haskell. If I have following function: ($) :: (a -> b) -> a -> b I understand that to partially apply this function I need to provide (a -> b) function ($'s first…
12
votes
5 answers

Find all words in a string that start with the $ sign in Python

How can I extract all words in a string that start with the $ sign? For example in the string This $string is an $example I want to extract the words $string and $example. I tried with this regex \b[$]\S* but it works fine only if I use a normal…
rdil2503
  • 325
  • 1
  • 3
  • 13
10
votes
1 answer

Meanings of dollar sign in Java method descriptor?

For example, its part of the Jikes RVM stack. at [0x70cfba90, 0x708cfaa4] Lorg/apache/lucene/index/SegmentInfos; **access$000**(Ljava/lang/String;)V at [0x70cfbb04, 0x708b55c8] Lorg/apache/lucene/index/SegmentInfos$ FindSegmentsFile;…
qinsoon
  • 1,433
  • 2
  • 15
  • 34
10
votes
2 answers

jQuery Dollar Sign Confusion

I'm a bit confused regarding the dollar sign in jQuery, and was hoping someone could help me out. I have the following function declaration: $(function() { $( "#create-discussion" ).button().click(function() { alert("Clicked"); }); …
sichinumi
  • 1,835
  • 3
  • 21
  • 40
10
votes
3 answers

What is the outcome in javascript with multiple librarys that use $

Let's pretend this is in the of your html page. OOPS this was a bit that was missing before...:
Doug Chamberlain
  • 11,192
  • 9
  • 51
  • 91
9
votes
1 answer

Dollar Sign "\$" in Regular Expressions with word boundaries "\b" (PHP / JavaScript)

I am aware that the issue involving the dollar sign "$" in regex (here: either in PHP and JavaScript) has been discussed numerous times before: Yes, I know that I need to add a backslash "\" in front of it (depending on the string processing even…
GerZah
  • 91
  • 1
  • 3
9
votes
1 answer

What does the "$$" mean in Postgresql function?

CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$ BEGIN RETURN i + 1; END; $$ LANGUAGE plpgsql; The above code is taken from the Postgresql website. However I do not understand why $$ is used. I…
Mox
  • 2,355
  • 2
  • 26
  • 42
9
votes
2 answers

Escaping $ dollar sign in CMake

I'm trying to run a post build command in CMake 3.1.1 via: ADD_CUSTOM_COMMAND( TARGET mytarget POST_BUILD COMMAND for i in `ls *` \; do echo \$i \; done \; However, the $i variable is evaluated to nothing although I escape the dollar…
Vyacheslav
  • 1,186
  • 2
  • 15
  • 29
9
votes
3 answers

What actually $ function does in haskell?

I know $ :: (a->b) -> a -> b f $ x = f x Intuitively it seems to me, like to say, 1. $ delays the evaluation of the function to its left 2. evaluates whats to its right 3. feeds the result of its left to its right. And it makes perfect sense…
Znatz
  • 1,530
  • 2
  • 18
  • 31
1
2
3
13 14