What is the equivalent of str(color) in iOS ?

what is the equivalent of this in iOS ?

Var c As Color c = Color.RGB(255, 100, 50) Var hexColor As String = Str(c)

Dim c As Color
c = Color.RGB(255, 100, 50)
Dim tHexRed, tHexGreen, tHexBlue, tHexAlpha As Text
tHexRed = "00" + c.Red.ToHex
tHexGreen = "00" + c.Green.ToHex
tHexBlue = "00" + c.Blue.ToHex
tHexAlpha= "00" + c.Alpha.ToHex

Dim hexColor As Text = tHexRed.Right(2) + _
tHexGreen.Right(2) + _
tHexBlue.Right(2) +  _
tHexAlpha.Right(2) 

Label1.Text = hexColor

or you turn it into an extension method for IOS for Colors

Module Colors
     Compatibility (iOS) Public Function ToHex(extends c as Color) as Text
             Dim tHexRed, tHexGreen, tHexBlue, tHexAlpha As Text

             tHexRed = "00" + c.Red.ToHex
             tHexGreen = "00" + c.Green.ToHex
             tHexBlue = "00" + c.Blue.ToHex
             tHexAlpha= "00" + c.Alpha.ToHex
  
             Dim hexColor As Text = tHexRed.Right(2) + _
             tHexGreen.Right(2) + _
             tHexBlue.Right(2) +  _
             tHexAlpha.Right(2) 
  
             return hexColor
           End Function
End module

oh my !
ok, i see !

"00" + c.Red.ToHex

can be shortened to

c.Red.ToHex(2)

Result:

Dim hexColor As Text = c.Red.ToHex(2) + _ c.Green.ToHex(2) + _ c.Blue.ToHex(2) + _ c.Alpha.ToHex(2)

ah yeah much better :stuck_out_tongue: