kotlin - Kotlin jvm html DOCTYPE
问题描述
我是一名 Java Dynosaur,前一天开始使用 Kotlin。
我发现自己在编码...
fun toFile(relativePathAndFileName : String) { // file stream out
File(relativePathAndFileName).printWriter().use { out ->
out.appendLine("<!DOCTYPE html>") // My question: is there a way to do this elegantly
.appendHTML().html {
lang = "en"
输出没问题,因为它添加了<!DOCTYPE>
,但代码out.appendLine("<!DOCTYPE html>")
对我来说就像是 hack。如何以 Kotlin 的方式让它更漂亮?
解决方案
推荐阅读
- javascript - 将 SQL 查询传递到 Inquirer Prompt
- c++ - C++ 多图打印
- verilog - 如何在 Verilog 中更改时钟?
- azure - 查看 Azure 组织中的所有订阅
- camera - RTSP:发送“描述”请求后未从服务器接收 SDP
- c# - 使用日期时间数据类型将日期转换为 MM/dd/yyyy 格式
- ios - 如何在 Swift 中检测 UIImageView 上的 UIImageView 已更改或 KVO 炒锅
- tableau-api - Tableau 中的活动分析
- kubernetes - Kubernetes 自定义指标在服务级别不可用
- python - 从 salesforce 获取列中的子元素