如何将Int转换为十六进制字符串?

时间:2017-01-28 09:28:52

标签: type-conversion haxe

是否可以将整数转换为6位十六进制代码?在AS3中,我有原生API

    library(shiny)
    server <- function(input, output, session) {
            rv <- reactiveValues(trigger = FALSE)
            output$plot <- renderPlot({
                    Sys.sleep(0.2)
                    plot(1:10, main=input$title)
                    rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col = sample(colors() ,1))
            })

            observeEvent(input$country, {
                    vals <- switch(input$country,
                                   US = 2001:2003,
                                   UK = 2001:2005,
                                   FR = 2002:2006)
                    rv$trigger = input$year == vals[1]
                    updateSelectInput(session, "year", choices = vals, selected = vals[1])
            })

            observeEvent(c(input$year, rv$trigger), {

                    updateNumericInput(session, "title", 
                                       value = paste(input$country, input$year))
                    if(rv$trigger == TRUE) {
                            rv$trigger = FALSE
                    }
            })

    } 

    ui <- fluidPage(

            tags$div(class="panel-body",

                     selectInput("country", "country", choices = c("US", "UK", "FR"), selected = "US"),
                     textInput("title", "Give a title",  "US 2001"),
                     selectInput("year", "year", choices = 2001:2003, selected = 2001)

            ),

            plotOutput("plot")

    )

    shinyApp(ui = ui, server = server)

Haxe在标准库中有这样的功能吗?

1 个答案:

答案 0 :(得分:2)

您可以使用StringTools.hex() http://api.haxe.org/StringTools.html#hex