Announcement

Collapse
No announcement yet.

How to replace a " ° " character in a vb script ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roger D
    replied
    What about using this instead ℃
    it’s the actual degree C symbol

    HTML code is
    &#8451
    You have to add a ; after the code above.


    Roger D

    Leave a comment:


  • jon00
    replied
    Originally posted by goldriver View Post
    jon00 thank you so much, I edited the file with Note entered ResTemp = Replace(DevTemp,"°C"," degré celsius") and now it works.
    Just remember NOT to open it in Homeseer's editor or it will be modified!

    Leave a comment:


  • goldriver
    replied
    jon00 thank you so much, I edited the file with Note entered ResTemp = Replace(DevTemp,"°C"," degré celsius") and now it works.

    Leave a comment:


  • jon00
    replied
    ° is the html code for the character °

    You will need to use a standard text editor rather than Homeseer's which is limited.

    Leave a comment:


  • goldriver
    replied
    jon00 I just tried the device viewer utility and there does not seem to be any HTML:

    Click image for larger version

Name:	aaa.JPG
Views:	256
Size:	6.5 KB
ID:	1505784

    I guess I need to find a way to enter ResTemp = Replace(DevTemp,"°C"," degré celsius") in the script but if I enter this line in the script editor, the editor immediatly change the ° by " ° "

    Leave a comment:


  • jon00
    replied
    You need to examine the actual device string code as it may contain html code for the degree symbol. If you have my device viewer & documenter installed, you can use the advanced view to see the string (code) being used.

    Example below:

    Click image for larger version  Name:	Capture.PNG Views:	0 Size:	40.3 KB ID:	1505645

    Alternatively, you can right-click on the web page and select 'view source' and try to find it there.

    Leave a comment:


  • goldriver
    replied
    Uncle Michael Unfortunatly, your solution gives the same results, the " ° " caracter is still not recognised by the replace function with chr(176), thanks for the try

    Leave a comment:


  • Uncle Michael
    replied
    You could try: ResTemp = Replace( DevTemp, Chr(176), " degré celsius")

    Leave a comment:


  • goldriver
    started a topic How to replace a " ° " character in a vb script ?

    How to replace a " ° " character in a vb script ?

    I am trying to build a specific weather forecast phrase to be sopken out of Sonos from different "Environment Canada" weather plugin devices.

    The problem I am having is I have a specific device string that contains the " ° " caracter that i would like to replace by "Degré Celcius" but I can't find a way for the Replace function to detect and replace this specific caracter.

    Here's an exemple that I am using for many other caracters and words replacement: ResSommaire = Replace(ResSommaire ,"05h00","à cinq heure. ") and this works fine but if iI try the below line (where DevTemp is 7.7°C)

    ResTemp = Replace(DevTemp,"°C"," degré celsius")

    the results of ResTemp is always 7.7°C and not 7.7 degré celsius as I would expect it to be

    Any idea ?
    thanks
Working...
X