每隔x次拆分列表

时间:2017-01-30 21:40:19

标签: java arrays list arraylist split

Hellow, 我想像列表中的每7个点一样拆分List(一个ArrayList)。 例如:

List<String> field = Lists.newArrayList("dsgtfsg","456hg","fg","s","fe","sdr","&&","fdg","hrdt","edts","dsf","a44","awfg");

field.split into (field_part1, field_part2, field_part3) after (7)
/* "dsgtfsg","456hg","fg","s","fe","sdr","&&" */   --> field_part1 
/* "fdg","hrdt","edts","dsf","a44","awfg" */ ---> field_part2
谢谢你们, 〜玉米

1 个答案:

答案 0 :(得分:0)

试试这个:

library(shiny)

ui <-  fluidPage(
  checkboxGroupInput(inputId="test.check", label="", choices="Uncheck For 2", selected="Uncheck For 2"),
  verbatimTextOutput(outputId = "test")
)

server <- function(input, output) {
  output$test <- renderPrint({
    if(!is.null(input$test.check)) {
      1
    } else{
      2
    }
  })
}

shinyApp(ui = ui, server = server)

否则,我同意@Timmeey的观点。