How can I show an ampersand in XAML text string? - xaml

I am trying to add an ampersand like this:
<Label Text="Phrase & Meaning Visible" />
This doesn't work so I tried to delimit with a \ and that also does not work. Does anyone have any suggestions on how I can do this?

Actually this question is not about XAML, it's just a pure XML question. Some characters need to be escaped in XML, the correct escaping of & is &

Taken this with thanks from the following blog post.
Special Symbols in XAML
For Ampersand sign <Label Text="&"/>
For less than sign <Label Text="<">
For greater than sign <Label Text=">"/>
For double quotes <Label Text="""/>

Related

How to convert dot to comma in smarty

Good morning,
Prestashop 1.6 in tpl file I have something like this
{assign var=groupPrice value=$psoft[0]['price']|number_format:2:",":"."}
<span class="price groupPrice">{$groupPrice*0.23+$groupPrice|number_format:2:".":","}</span>
The results is 456.34 (for example). How to convert this dot to comma?
Thanks for help.
Kind regards
you can use that :
math|replace:".":","
In code:
number_format:2:".":","
Replace the first dot to comma. You'll get the result:
number_format:2:",":","

how to remove special characters from string in volt templates

Please can anyone help me on this issue? how to remove special characters from string
Thanks in advance
You can use the filters available for Volt
https://docs.phalconphp.com/4.0/en/volt.html#filters
So your code becomes
{{ title | escape }}

Visual studio 2013 with windows 8.1

I am designing an calculator interface with visual studio 2013.I need to enclose "{" and "}" braces as two buttons in calculator.But when "{" button include as the button content,there is an error saying "mark up extension does not properly called".How can I enter the "{" brace just as a sign in the content field.
Thanks.
In XAML you can escape the curly brace by adding extra opening and closing curly brace like this:
<Button Content="{}{This is a text with curly braces}" />
Or you can use the extended version without any escaping:
<Button>
<Button.Content>
{This is a text with curly braces}
</Button.Content>
</Button>

How to handle new line in handlebar.js

I am using HandleBar.js in my rails jquery mobile application.
I have a json returned value data= "hi\n\n\n\n\nb\n\n\n\nhow r u"
which when used in .hbs file as {{data}} showing me as hi how r u and not as with the actual new line inserted
Please suggest me.
Pre tag helps me
Handlebars doesn't mess with newlines in your data unless you have registered a helper which is doing something with them. A good way of dealing with newlines in HTML without converting them to br tags would be to use the CSS property white-space while rendering the handlebars template in HTML. You can set its value to pre-line.
Read the related documentation on MDN
Look at the source of the generated file - your newline characters are probably there, HTML simply does not render newline characters as new lines.
You can insert a linebreak with <br />
However, it looks like you're trying to format the position of your lines using newline characters, which technically should be done by wrapping your lines in <p> or <div> tags and styling with CSS.
Simply use the CSS property white-space and set the value as pre-line
For a example:
<p style="white-space: pre-line">
{{text}}
</p>

How to insert special HTML-symbols with HAML

When I'm saying:
%p= item.price + " dollars"
I'm getting
50&nbsp ;dollars
instead of having non-breakable space symbol.
How to insert this and another special symbols using HAML ?
How about
%p= item.price + " dollars".html_safe
Use != instead of =
See "Unescaping HTML" in the haml reference: http://haml.info/docs/yardoc/file.REFERENCE.html#unescaping_html
The interpolation option:
%p= "#{item.price} dollars".html_safe
I tried using html_safe in different ways, but none worked. Using \xa0 as suggested by ngn didn't work, either, but it got me to try the Unicode escape of the non-breaking space, which did work:
"FOO\u00a0BAR"
and .html_safe isn't even needed (unless something else in the string needs that, of course).
The Ruby Programming Language, first edition, says: "In Ruby 1.9, double-quoted strings can include arbitrary Unicode escape characters with \u escapes. In its simplest form, \u is followed by exactly four hexadecimal digits ..."
This answer is for a slightly different question but I found this question searching for it...
If you have a submit tag %input{ :type => "submit", :value => " dollars", :name => "very_contrived" } even if you throw an html_safe on the :value it will not evaluate the html.
The solution is to use the rails helper... duh
= submit_tag " dollars".html_safe
this is pretty obvious but it tripped me up. Legacy code + rails upgrade = this kind of stuff :P
You could use \xa0 in the string instead of . 0xa0 is the ASCII code of the non-breaking space.
I prefer using the character itself with the escaped HTML method with most symbols other than the whitespace characters. That way i don't have to remember all the html codes. As for the whitespace characters i prefer to use CSS, this is a much cleaner way.
%p&= "#{item.price} $%&#*#"