Graphics

 View Only
  • 1.  xpression converting text into integer question

    Posted 07-23-2013 17:39
    Hi, I have a field in Excel that says this "20°C", is there a way to ignore the "C" character, so my text only display "20°", or just the number "20", im guessing I have to convert the text into an integer, but I dont know the code, I have tried with OnSetText >>>> text = CInt(text), but It doesnt seem to work


  • 2.  RE: xpression converting text into integer question

    Posted 07-23-2013 17:50
    Luis,

    It sounds like what you want to do is trim that "C" character off. Try running a script like this using the onSetText event.

    text = Left(text,3)

    this will ensure you only see the 3 characters originating from the left which will trim off the "C".

    Andrew

    #XPression


  • 3.  RE: xpression converting text into integer question

    Posted 07-23-2013 17:54
    Hi, thanks for the quick reply, the problem with that is sometimes I would get: 24.5°C, or 1°C. Is there a way to trim just the last character?

    #XPression


  • 4.  RE: xpression converting text into integer question

    Posted 07-23-2013 18:27
    Good point.

    Try this instead.

    text = text.replace("C", "")

    this will replace the that specific character with an empty character.

    Andrew

    #XPression


  • 5.  RE: xpression converting text into integer question

    Posted 07-23-2013 18:37
    nice! it worked!

    #XPression


  • 6.  RE: xpression converting text into integer question

    Posted 07-24-2013 15:55
    Hi, me again, I have been trying to convert the decimal values I have into round numbers without succes

    I have tried the following :

    text = Int(text)

    and

    text = Convert.toInt32(text)

    also,

    Round.text (from java script) dont work either.

    ____________________________

    example: I have 24.5, I want to output 25 (round number without decimals)

    #XPression


  • 7.  RE: xpression converting text into integer question

    Posted 07-24-2013 17:47
    Text = Math.Round(CInt(Text))

    You might need to strip the degree symbol off first though..

    #XPression