Announcement

Collapse
No announcement yet.

Convert to string to an int

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

    Convert to string to an int

    Hello everyone,

    I'd like to convert a string to an int (implicitly or explicitly). But the compiler keeps telling me that there is a "type mismatch in '='".

    My code is :

    Code:
    result = MySplit(Text, ";",false) ; // Returns an array<string>
    varFC = result[0] ; // varFC is an  int variable
    I heard that Unreal did implciit conversion, so it leaves me puzzled.

    Thanks for your help.

    Antosar

    #2
    String to Byte, Int, Float: Tries to convert a string like "123" to a value like 123. If the string doesn't represent a value, the result is 0.
    from http://udn.epicgames.com/Three/UnrealScriptReference.html

    Comment


      #3
      Another, more compact list of possible conversions: http://wiki.beyondunreal.com/Typecasting#string_to...

      Comment


        #4
        Use this:

        Code:
        result = MySplit(Text, ";",false) ; // Returns an array<string>
        varFC = int(result[0]) ; // varFC is an  int variable
        You didn't cast the string to an int

        Comment

        Working...
        X