scala在映射器中添加一个字符串

时间:2016-10-14 15:48:37

标签: string scala dictionary functional-programming

您好我有以下代码获取每一列并生成一个用逗号分隔的字符串。

val selectCols    = t.columns.map( c => cmap.getOrElse(c.name, c.name)).mkString(",")

Output: store_id,date_id,user_id,data,other_column

但我想修改此map函数以获取以下字符串:

t.store_id,t.date_id,t.user_id,t.data,t.other_column

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

table { margin: auto;
        width: 70%;
        height: 500px;
        border-collapse: separate;
        border-spacing: 20px;
}
.tableImage { background-image: url(chick.png);
              background-repeat: no-repeat;
              background-position: center
}
caption { font-size: 1.5em;
}      
td, th { border: 2px solid #3399cc;
         padding: 5px;
}
td { text-align: center;
}
tr:nth-of-type(even) { background-color: #b3cce6;
}
tr:nth-of-type(odd) { background-color: #b3e6cc;
}


<table>
<caption>The Polish Chicken</caption>
<tr>
  <th>text</th>
  <th>text</ht>
  <th>text</th>
<th>text</th>
</tr>

<tr>
  <td>text</td>
  <td colspan="2", rowspan="4", td class="tableImage">Silver Laced Polish Chicken</td>
  <td>text</td>
</tr>

<tr>
  <td>text</td>
  <td>text</td>
</tr>

<tr>
  <td>text</td>
  <td>text</td>
</tr>

<tr>
  <td>text</td>
  <td>text</td>
</tr>

<tr>
  <td>text</td>
  <td>text</td>
  <td>text</td>
  <td>text</td>
</tr>

</table>