字符串函数用于将一个字符串转换为整型数字。
The parseInt function parses a string and returns an integer.
您可以看到,该方法将字符串转换为大写字母。
As you can see that method converted the string to uppercase.
现在,价格从一个字符串转换为一个浮点类型。
At this point, the price is converted from a string to a float.
printf And then I'm gonna use the same printf line after that to actually plop it into this formatted string.
我还是要用到,来把它转换成格式化字符串。
How do we typically print things, we convert them to strings.
我们一般是怎么显示对象的呢?,对,把它们转换为字符串。
Well I need to take that number and I'm going to turn it into a string. So notice what I'm going to do right here. I take that number and convert it into a string. That's an example of that type conversion we did earlier on. By doing that it makes it possible for me to treat it as an ordered sequence of characters.
我可能得把这个数字变为字符串,请注意我这里是怎么做的,我把这个数字,转化为字符串了,这是我们之前学过的,类型转换的例子,这么一来我就能把它按照有序的。
应用推荐