What does the double percentage sign (%%) mean?
The "Arithmetic operators" help page (which you can get to via ?"%%"
) says
‘
%%
’ indicates ‘x mod y’
which is only helpful if you've done enough programming to know that this is referring to the modulo operation, i.e. integer-divide x
by y
and return the remainder. This is useful in many, many, many applications. For example (from @GavinSimpson in comments), %%
is useful if you are running a loop and want to print some kind of progress indicator to the screen every nth iteration (e.g. use if (i %% 10 == 0) { #do something}
to do something every 10th iteration).
Since %%
also works for floating-point numbers in R, I've just dug up an example where if (any(wts %% 1 != 0))
is used to test where any of the wts
values are non-integer.
What does a double percentage sign (%%) mean in JavaScript?
It appears to be a templating tool, that the people who made the template would change according to what they want to put in there.
Significance of double percent signs (%%) in T-SQL PATINDEX
The official documentation of PATINDEX
states that:
pattern
Is a character expression that contains the sequence to be found. Wildcard characters can be used; however, the%
character must come before and follow pattern (except when you search for first or last characters)
The %
wildcard stands for,
as written in the official documentation for LIKE
:
any string of zero or more characters.
The fact that it can stand for any number of characters including zero, means that %%
is completely equivalent to %
and there for can be safely be changed.
Please note that this is not the case with any other T-SQL wildcards - since _
stands for a single char, as well as []
and [^]
.
What does the double percent symbol do in Python?
This is not Python-specific. Whoever wrote that code is using the string "%%NOM%%
as a placeholder, and using it to substitute the value of nom
.
What's the difference between % and %% for comments?
From a syntax point of view, they are both comments.
In the Matlab editor, Matlab parses %%
delimited blocks as "sections" which you can run as a unit independent of running the whole script.
What does a double-percent sign (%%) do in gcc inline assembly?
GCC inline assembly uses %0, %1, %2, etc. to refer to input and output operands. That means you need to use two %% for real registers.
Check this howto for great information.
In R, how does double percent work when used on a matrix?
(Hope I haven't over explained this and interpreted what you're asking correctly:)
As you've said, you know that %%
is the modulus operator. So
a <- data.frame(1:50)
a %% 10
returns 'x mod 10' for each item in the frame (or 1,2,3,4,5,6,7,8,9,0 etc etc)
The two examples you've given are like 'shorthand' for if
statements. In pseudo code:
for n = 1 to length of a
if a[n] %% 10 equals zero
return true
else
return false
So a %% 10 == 0
is "Does the element mod 10 equal zero" and a %% 10 == 2
is "Does the element mod 10 equal two" applied to each element
And the result is matrix of logicals (booleans).
Double percent sign in css
The width:50%%
is invalid, it means <audio>
will take the user agent style i.e. width:300px
(See in the inspect) in chrome. Thats why its working.
The width:50%
is valid, but in your case width is not working because your parent has 0
width and 0%
of 0
is also 0
.
Try to give width in px
or give width to your parent.
Stack Snippet
<div class="col-md-8" style="display:inline-block;"> <audio style="width:100px" controls="controls"> Your browser does not support the <code>audio</code> element. <source src="music_mix.mp3" type="audio/mp3"> </audio></div>
What do the %op% operators in mean? For example %in% ?
Put quotes around it to find the help page. Either of these work
> help("%in%")
> ?"%in%"
Once you get to the help page, you'll see that
‘%in%’ is currently defined as
‘"%in%" <- function(x, table) match(x, table, nomatch = 0) > 0’
Since time
is a generic, I don't know what time(X2)
returns without knowing what X2
is. But, %in%
tells you which items from the left hand side are also in the right hand side.
> c(1:5) %in% c(3:8)
[1] FALSE FALSE TRUE TRUE TRUE
See also, intersect
> intersect(c(1:5), c(3:8))
[1] 3 4 5
mysql LIKE with double percent
As in the answer Mihir Dave's comment links to, there's no difference to SQL if you pass %%
instead of %
. Since a single %
matches zero or more characters, then each of the metacharacters in %%
would also match zero or more, and ultimately the same string would match one way or another.
But I'd guess your legacy code is pre-Python 2.6 that uses %
as a metacharacter in string formatting, and you have to double it like %%
to get a single literal %
character.
See also:
- How can I selectively escape percent (%) in Python strings?
- https://docs.python.org/2.6/library/stdtypes.html#string-formatting-operations
Related Topics
Fastest Way for Filling-In Missing Dates for Data.Table
R Convert Between Zoo Object and Data Frame, Results Inconsistent for Different Numbers of Columns
Namespace Dependencies Not Required
Does Roxygen2 Automatically Write Namespace Directives for "Imports:" Packages
How to Reference the Local Environment Within a Function, in R
Accessing Excel File from Sharepoint with R
Encrypting R Script Under Ms-Windows
Forcing R (And Rstudio) to Use the Virtual Memory on Windows
Convert from Lowercase to Uppercase All Values in All Character Variables in Dataframe
Cor Shows Only Na or 1 for Correlations - Why
"Factor Has New Levels" Error for Variable I'm Not Using
Subtract a Constant Vector from Each Row in a Matrix in R
Alternatives to Nested Ifelse Statements in R
Calculate Sum of a List of Variables by Group
Installing R 3.5.0 with --Enable-R-Shlib
Do I Need to Normalize (Or Scale) Data for Randomforest (R Package)