Print double quote inside #"" [duplicate] - objective-c

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 (-: )

Related

decode this regex [duplicate]

This question already has answers here:
What do comma separated numbers in curly braces at the end of a regex mean?
(6 answers)
Closed 3 years ago.
I've tried to understand the below but don't seem to get the last part of the regular expression which has {1,40}. Overall, I know the pattern tries to match the special characters and something else (the {1,40})
regexp_like(COLUMN,'^['||UNISTR('\0020')||'-'||UNISTR('\0060')||UNISTR('\007B')||UNISTR('\007D')||UNISTR('\007E')||UNISTR('\00C0')||'-'||UNISTR('\00DF')||']'||'{1,40}$')
regexp_like() checks that a string matches the regex provided as second argument.
Your regexp looks like ^[...]{1,40}$.
^ is the beginning of the string and $ is the end, so the entire string must match the regex.
[...] is a character class, that contains a bunch of characters code points. All characters of the string must belong to that list (any other character is forbiden). You would need to to check what they correspond to: unicode.org is your friend. For the first code points:
\0020 space
\0060 grave accent
\007B left curly bracket
finally, {1,40} is a quantifier: the length of the string must be at least one and at most 40.

Search by regular pattern in iOS [duplicate]

This question already has answers here:
What's the regular expression that matches a square bracket?
(10 answers)
Closed 3 years ago.
Trying to search bbcode-style tags with regular expression:
For example, I needed [user=1]John Dow[/user] with regular: [[user=[0-9]+].*?[/user]]
But couldn't receive needed result.
Remove the outer pair of brackets and escape the literal brackets (unlike the range-of-characters brackets)
let pattern = "\\[user=[0-9]+\\].*?\\[/user\\]"

Alternates to quotation marks in Objective C [duplicate]

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'");
}

SQL Server: How to call a string with apostrophe in name [duplicate]

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.

VB.NET function for uppercasing the first letter of each word [duplicate]

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.