And it boils down to modifying the format string with just a simple number.
它归结于是用一个简单的数字来,修改字符串的格式。
The format is the same. I'm going to ask for some input, and then I am going to use that procedure to check, is this the right type of value. And I'm trying to use that to do the coercion if you like. Same thing if it works, I'm going to skip that, if it not, it's going to throw the exception.
格式是一样的,我需要一些输入,然后我要用一个过程来检查,是否是正确的值,然后你就可以做强制转换了,如果能运行,那是一样的,我打算跳过这段,如果不正确,那就会抛出一个异常。
Now as an aside, turns out you can do more interesting formatting with printf, and this is useful even for ASCII art purposes.
说点题外话,结果你可以用printf来打印其他的格式,这是非常有用的,甚至是为了ASCII艺术的目的。
应用推荐