This question already has answers here:
What does "! []" Elm code syntax in Todomvc mean
(2 answers)
Closed 6 years ago.
What does the bang (or exclamation mark) operator do in elm? I saw an application with an init like this:
init = emptyModel ! []
I've tried looking in the elm docs, but either there is no info or I couldn't find it:)
The definition of the ! operator is here.
It takes a model, a list of commands and returns a tuple (pair) with a model and a single command which is the batch of all the commands
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 2 years ago.
I am getting a Parse error: syntax error, unexpected '–' (T_STRING) in the following line:
$lbm = ((0.407 * $weightkg) + (0.267 * $heightcm) - 19.2) / 0.453592;
From what I see, I am using a subtraction sign and not a hyphen. Other than that, I don't know what could be wrong. Anyone know how to fix this?
Well, the character you pasted into the title is definitely an en-dash rather than a minus symbol(a) so PHP is rightly complaining about it.
The line in the main body of your question is a hyphen so either you've typed in in differently or that's not the line where the error is (PHP can sometimes be a bit iffy as to where it reports errors, so you may want to look on the few lines immediately around the one it reports the error to be on).
(a) Which is actually distinct from a hyphen, at least in typography, so you may want to beware of lunatic typographers coming around to beat you up for your transgressions :-)
This question already has answers here:
Is it possible to include a quotation mark as part of an nsstring?
(7 answers)
Closed 8 years ago.
I have this line of code in a method:
system("osascript -e 'tell app "System Events" to restart'");
As you can see, I've got two quotation marks, and since these terminal commands have to be so specific, I need to know another way to run a system command from ObjC. I've already tried using '' and the / method but that didn't work out.
You need to "escape" the quote characters to tell the compiler that the should be part of the string rather than delimiters of the string. You say you "tried using … the / method", but you got the wrong character. You escape characters using the backslash, not the forward slash:
-(IBAction)reboot:(id)sender{
system("osascript -e 'tell app \"System Events\" to restart'");
}
This question already has an answer here:
T-SQL escape quote character
(1 answer)
Closed 8 years ago.
WHERE Variable = 'Lowe's';
But string is ending at Lowe because it recognizes the 's as end of String.
How to circumvent this?
Use two '
WHERE Variable = 'Lowe''s'
SQLFiddle demo
Although escaping ' with '' works, in case you are running this command from any application you should take a look at databinding and using SqlParameters - spares you a lot of headache, improves performance and security.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to escape double quotes in string?
I need to print a "abc" inside #""
My current string is
[displayLbl setText:#"press stop"];
But i need:
[displayLbl setText:#"press "stop""];
How can i do this?
[displayLbl setText:#"press \"stop\""];
Roland Keesom's answer is of course correct. But you might also consider to use typographic quotation marks, which usually look better:
[displayLbl setText:#"press “stop”"];
(You only have to find them on the keyboard (-: )
This question already has answers here:
How to uppercase the first character of each word using a regex in VB.NET?
(9 answers)
Closed 8 years ago.
I'm looking for do this in VB.NET,
hy how are you
to,
Hy How Are You
Anyone have any idea?
This following will do what you want without using regex (and is more readable than a regex solution):
Dim s As String = "some sentence that i want to capitalise"
Debug.WriteLine(Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s))
Output:
Some Sentence That I Want To Capitalise
And you can also do this (from the Microsoft.VisualBasic Namespace):
Debug.WriteLine(StrConv(s, VbStrConv.ProperCase))
You can do that using regular expressions. There are a useful class named Regex that will help you a lot. Please follow this link for more information.