我正在使用scala的Map#get
函数,对于每个准确的查询,它都会以Some[String]
形式返回
有没有一种简单的方法删除Some
示例:
def searchDefs{
print("What Word would you like defined? ")
val selection = readLine
println(selection + ":\n\t" + definitionMap.get(selection))
}
当我使用此方法并使用以下输入时:
What Word would you like defined? Ontology
返回值为:
Ontology:
Some(A set of representational primitives with which to model a domain of knowledge or discourse.)
我想删除它周围的一些()。
有什么建议吗?
https://stackoverflow.com/questions/9389902
复制相似问题