Reputation: 427
I have a constant declared in typescript file as mentioned below.
const PASS_SPN_TXT = [ { name: 'PASS V C' },
{ name: 'PASS. T12 C' }];
In actual I want the names as PASS V degree symbol C and PASS.T12 degree symbol C. How to get degree symbol in a string.
Upvotes: 1
Views: 6437
Reputation: 973
The accepted answer did not work for me. for some reason I ended up with literally:
...
'System Temp (\xB0C)'
...
What worked for me though (based on this answer )
...
'System Temp (°C)'
...
Upvotes: 0
Reputation: 1964
Or use hexadecimal code \xB0 like this:
const PASS_SPN_TXT = [ { name: 'PASS V \xB0C' },
{ name: 'PASS. T12 \xB0C' }];
Upvotes: 8