I would like to use a dollar sign in a flutter, how can I do this? [duplicate] - flutter

This question already has answers here:
Special characters in Flutter
(6 answers)
Closed 2 years ago.
I would like to use a dollar sign in a flutter, how can I do this?
like this:
Text('$21.99')

Use Escape Sequence Character,
Text('\$21.99')

You can use raw string by suffixing r.
Like this
Text(r'$21.99')

Related

Flutter How to not show the [] Brackets of a list when being displayed as a text? [duplicate]

This question already has answers here:
Display a list of integers as a String
(3 answers)
Closed 3 years ago.
I am trying to display a list rendered in text. But when I do I see the []
I have tried the following.
Text(hashList.toString().replaceAll("(^\\[|\\])", ""))
Brackets are still there.
You can do it like this
Text(hashList.join())
or you can use a delimiter
Text(hashList.join(','))

Swift 4 regex custom validation [duplicate]

This question already has an answer here:
Learning Regular Expressions [closed]
(1 answer)
Closed 4 years ago.
i need some help to write correct regex validation. I want password with no spaces, min. 6 symbols, doesn't matter numbers or letters or symbols. Alphabet a-zA-Z and а-яА-Я(RU). How i can do that?
"^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{6,}$"
You can take a look at this link

best / quick way to remove character from string at a given index (swift 4) [duplicate]

This question already has answers here:
Remove nth character from string
(4 answers)
Closed 4 years ago.
I'm trying to remove the third character from a string. however, there does not seem to be a clean way to do this. I couldn't find an extension that does this and using a library is a bit overkill
I probably could take the first start range up to this character, then the last range and concatenating these together feels quite wrong and there must be a better way IMO
Any help is appreciated!, Thanks!
You can do that the below way:
var str = "I am Bla Bla"
if str.count > 2 {
str.remove(at: String.Index(encodedOffset: 2))
print(str)
}
Hope this helps.

See what characters are in an NSCharacterSet [duplicate]

This question already has answers here:
NSArray from NSCharacterSet
(9 answers)
Closed 7 years ago.
When I'm trying
print(NSCharacterSet.URLQueryAllowedCharacterSet())
it prints
<__NSCFCharacterSet: 0x1759b900>
How do I make it more informative?
You can get a representation of the character set using bitmapRepresentation which could be queried. Or you could do basically the same thing with a loop over all characters and using characterIsMember:. The output is potentially big...
There isn't really a simple option or a generic concise output to what you're asking for. It isn't a common requirement.

How to eregi_replace to preg_replace [duplicate]

This question already has answers here:
How can I convert ereg expressions to preg in PHP?
(4 answers)
Closed 8 years ago.
eregi_replace('[0-9]+\.+[0-9]','',$cart['unit']);
How to change it to preg_replace?
I get an error: Warning: preg_replace() [function.preg-replace]: Unknown modifier '+' in ---
You can use your existing Regex almost unchanged in a preg_replace(). Just add delimiters and a case-insensitive modifier. You get
preg_replace('#[0-9]+\.+[0-9]#i','',$cart['unit']);
In fact, the case-sensitivity is irrelevant since your pattern only matches 0-9 and .