How to include "" in a String in swift [duplicate] - swift

This question already has answers here:
How to print double quotes inside ""?
(3 answers)
Closed 2 years ago.
I have a really simple question and I bet the answer is as simple..
I want to create a String which include the symbol " twice, such as (Hello "" World !) or (Hello "new" World !), without breaking my String (for comprehension purpose, I've put my sentences inside of parentheses instead of said symbol ").
I can't remember the name of the symbol ("), so I can't google anything, because (" ") is not clear enough for searching motor..
I hope I'm being clear, thank you for your help !

You can use hashtag before and after the double quotes to allow any special character to be added inside your string:
let string = #"Hello "" World !"#

Related

How to match the first word after a specific expressions with regex? [duplicate]

This question already has answers here:
Python Regex Engine - "look-behind requires fixed-width pattern" Error
(3 answers)
Regex to get the word after specific match words
(5 answers)
Closed 8 months ago.
This post was edited and submitted for review 8 months ago and failed to reopen the post:
Original close reason(s) were not resolved
My code below match the first word after one expression "let" :
(?<=\blet\s)(\w+)
What I need is to match the first word after a specific expressions, "let", "var", "func"
Input text:
let name: String
var age: Int
func foo() {
//...
Expected:
name
age
foo
Here is an image for clarity:
Since some regex flavors do not allow using groups inside lookbehinds and alternatives of different length, it is safe to use a non-capturing group with the lookbehind as alternatives:
(?:(?<=\blet\s)|(?<=\bvar\s)|(?<=\bfunc\s))\w+
Here, (?:...|...|...) is a non-capturing group matching one of the three alternatives: (?<=\blet\s), (?<=\bvar\s) and (?<=\bfunc\s).

I Can't define string in dart with $ in it [duplicate]

This question already has answers here:
How do you print a dollar sign $ in Dart
(2 answers)
Closed 2 years ago.
I want to use this as String in Dart.
String s = 'reservoir$lbc_release'
Getting error due to $. How do I solve this?
Just use escape sequence
print('Hello \$');
Please use '\' in front of '$'
String s = 'reservoir\$lbc_release'

Powershell function call in verbatim string [duplicate]

This question already has answers here:
PowerShell outputting array items when interpolating within double quotes
(3 answers)
Closed 6 years ago.
Is a function call in a verbatim PowerShell string a thing?
CSharp example:
$"this my { GetSomeValue() }";
I would rather not extract a variable if I don't have to.
I always do it this way:
$verbatimString = 'something' + (GetSomeValue) + 'end'
Since it's verbatim string, you cannot do any trick, to put value directly into it, like you showed in your example.
Remember to call functions without (), you can read about it here: 4988226

I want to split a csv file with , and " with the latter hashigher precendence [duplicate]

This question already has answers here:
How do I split a string into an array by comma but ignore commas inside double quotes?
(7 answers)
Closed 8 years ago.
I want to split a csv file. ex a row contain name,id,address,pin etc..... if the adress contains again commas then how to parse? ex: Abc,123,"xyz,asd,pqr",123456 "xyz,asd,pqr" is one element and kept in double quotes only
Use a CSV parser. If you don't want to install new modules for some reason then look at Text::ParseWords instead.

Read Array of NSDictionaries With String Interpolation in Swift [duplicate]

This question already has answers here:
escape dictionary key double quotes when doing println dictionary item in Swift
(5 answers)
Closed 8 years ago.
This freaks out because it finds an unexpected " in the string interpolation:
let temp = "\(catalogueRows[0]["person"])"
Tried using single quotes but that didn't work. Seems like a pretty simple step and I'm confused why it doesn't work.
You can't use quotes in a string interpolation. That's just the way the syntax is.
You can't "escape" or single-quote your way out. You'll need two lines of code to do what you're trying to do:
let temptemp = catalogueRows[0]["person"]
let temp = "\(temptemp)"