This question already has answers here:
How to add percent sign to NSString
(7 answers)
Closed 8 years ago.
I searched and could not find this answer...
If I have this, how can I get it to display the final % symbol? It just omits it in my label.
[NSString stringWithFormat:#"Tries %i%", tries];
I thought I could contribute a bit and share this comprehensive list of options. Jesse is
right!
In my case, the following does the trick!
[NSString stringWithFormat:#"Progress: %.2f%%", progress*100]
// progress is float ranging 0.0-1.0,
//and I would like it to print up to 2 decimal point
Happy coding!
Related
This question already has answers here:
Erlang: What does question mark syntax mean?
(3 answers)
Closed 2 years ago.
I see alot of code in erlang with a question mark before it, what does it mean? Is it Macros or can it be used in another way? Example:
{Total, Pids} = run(10, 20),
?assertEqual(200, Total),
?assert(processes_stopped(Pids)).
or:
?MODULE
When you try call macros, you need add in start of name ‘?’. Notes: the macros can create with or without arguments.
This question already has an answer here:
Different Colored Comments
(1 answer)
Closed 1 year ago.
Since when can you do color comments in R?
#'*this some colorful comment*
#'**
-> gives you the ability to annotate in colour .
I found this by sheer accident & couldn't find anything on the internet about this matter ;
Is this meant for something else, or was it just a secret?
thx to Stefan, i now know its Roxygen!
This question already has answers here:
Line break in expression()?
(2 answers)
Closed 2 years ago.
I want to make a legend title reading
CO₂-text1
text2
Since paste()/paste0() doesn't seem to work on expression I also tried using bquote() instead, but can't figure a way to add the new line. My most succesfull attempt so far:
expression("CO"[2]*"-text1 \n"*" text2")
, which results in
-text1
CO₂ text2
expression(atop("CO"[2]~"text1",text2))
solved the issue (see question-comments).
This question already has answers here:
How can I reverse the order of lines in a file?
(24 answers)
Closed 7 years ago.
I need to print a file, but from the last line to the first.
I think I can append a number to the beginning of each line, sort descending, and then remove the line numbers, but there's probably some more elegant way to do that. is there?
You can use tac command
(tac- cat spelled backwards...)
This question already has answers here:
How can I paste 100000 without it being shortened to 1e+05? [duplicate]
(3 answers)
Closed 9 years ago.
The result of function was displayed in scientific notation, I want to change it back to normal, but only for that function, I don't want to change the global setting. Can anyone help?
You can do:
format(functionResult, scientific=FALSE);
or:
as.integer(functionResult);