none
extract from string RRS feed

  • Question

  • I used a weather site
    Data were extracted as follows: 16 ° C: 25 ° C
    I want to draw the second part ==> 25

    I used the following method and work but use the code several times and take time with me I want a better code for this

      Dim highweath = "16 °C  : 25 °C "
            MsgBox(highweath.Remove(0, highweath.IndexOf(":") + 2).Replace(" °C ", ""))

    Friday, April 13, 2018 10:41 PM

Answers

  •  How many times are you using it?  I can process 10,000 strings of  "16 °C  : XX °C "  where XX is a random number,  and it only takes about 16 milliseconds.  That is not even enough for a user to even notice.  It happens almost instantly.  Perhaps you have other things in your code that are slowing it down.

     There are several ways you could process the string and get what you want but,  I can not see where it could be taking that much time unless you are processing an outrageous amount of strings.  Even 500,000 strings are processed in about 750 milliseconds.  That is not even 1 second.


    If you say it can`t be done then i`ll try it

    • Marked as answer by monemas Saturday, April 14, 2018 4:22 PM
    Saturday, April 14, 2018 12:02 AM
  • Within my country the net is weak and the majority gets 1 megabyte speed on people
    So always see the speed at the user

    The code you use to do the calculation will have no effect on the speed with which the result is delivered to the user. You should look for your speed problems elsewhere.

    • Marked as answer by monemas Saturday, April 14, 2018 4:23 PM
    Saturday, April 14, 2018 1:52 AM

All replies

  • If you split that string using ":" you get this

    Array(0) = "16 °C  "
    Array(1) = " 25 °C "

    Friday, April 13, 2018 11:48 PM
  •  How many times are you using it?  I can process 10,000 strings of  "16 °C  : XX °C "  where XX is a random number,  and it only takes about 16 milliseconds.  That is not even enough for a user to even notice.  It happens almost instantly.  Perhaps you have other things in your code that are slowing it down.

     There are several ways you could process the string and get what you want but,  I can not see where it could be taking that much time unless you are processing an outrageous amount of strings.  Even 500,000 strings are processed in about 750 milliseconds.  That is not even 1 second.


    If you say it can`t be done then i`ll try it

    • Marked as answer by monemas Saturday, April 14, 2018 4:22 PM
    Saturday, April 14, 2018 12:02 AM
  •  How many times are you using it?  I can process 10,000 strings of  "16 °C  : XX °C "  where XX is a random number,  and it only takes about 16 milliseconds.  That is not even enough for a user to even notice.  It happens almost instantly.  Perhaps you have other things in your code that are slowing it down.

     There are several ways you could process the string and get what you want but,  I can not see where it could be taking that much time unless you are processing an outrageous amount of strings.  Even 500,000 strings are processed in about 750 milliseconds.  That is not even 1 second.


    If you say it can`t be done then i`ll try it

    Please allow me to repeat my request regarding speed in code execution
    I used the variable cropping 17 times I said maybe the misuse of the variable
    Within my country the net is weak and the majority gets 1 megabyte speed on people
    So always see the speed at the user

    Saturday, April 14, 2018 1:10 AM
  • Within my country the net is weak and the majority gets 1 megabyte speed on people
    So always see the speed at the user

    The code you use to do the calculation will have no effect on the speed with which the result is delivered to the user. You should look for your speed problems elsewhere.

    • Marked as answer by monemas Saturday, April 14, 2018 4:23 PM
    Saturday, April 14, 2018 1:52 AM