我想从字符串对象中提取有用的字段,如下所示
Request(Some(8454439),Some(16872692),Some(0.0.0.0),Some(8281008),Some(ArrayBuffer(845434399)),Some(129032),Some(3),Some(Profile),Some(en),None,None,None,None,Some(true),None,Some(Food),None,Some(Fish))
它总共有 18 个字段,我想要做的是将它们分配给 18 个不同的字符串,如果是,则提取有用的信息Some(X)
,否则将字符串设置为None
.
例如在这种情况下,响应中的字符串数组应该是
val results = Array("8454439", "16872692", "0.0.0.0", "8281008", "ArrayBuffer(845434399)",
"129032", "3", "Profile", "en", "None", "None", "None", "None", "true", "None",
"Food", "None", "Fish")