快速打印而不换行 [英] print without newline in swift

查看:30
本文介绍了快速打印而不换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 swift 2.0 中,print() 会自动添加换行符.在 swift 1.2 中,println()print() 曾经是单独的函数.那么如何打印一些文本而不是向其中添加换行符,因为 swift 不再具有不附加换行符的打印功能.

In swift 2.0, print() automatically adds a newline character. In swift 1.2, println() and print() used to be separate functions. So how do I print some text and not add a newline to it since swift no longer has a print function that does not append newlines.

推荐答案

从 Swift 2.0 开始,推荐的不换行打印方式是:

Starting in Swift 2.0, the recommended method of printing without newline is:

print("Hello", terminator: "")

这篇关于快速打印而不换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆