Conversion of Strings and Numbers-AWK零碎2--【每日一译】--20130202
2013-08-01 17:00
393 查看
Strings are converted to numbers, and numbers to strings, if the context of the awk program
demands it. For example, if the value of either foo or bar in the expression foo + bar happens to
be a string, it is converted to a number before the addition is performed. If numeric values appear
in string concatenation, they are converted to strings. Consider this:
译:字符串转换成数字,和数字转换成字符串,当AWK程序的上下文环境需要它时。比如值是
“foo"或"bar"在表达式中foo+bar将变成一个字符串,它被转换成数字在执行加法运算前。如果数字
字符出现在字符串的合并中,它们将会被转成字符串。如下:
two = 2; three = 3
print (two three) + 4
This eventually prints the (numeric) value 27. The numeric values of the variables two and three
are converted to strings and concatenated together, and the resulting string is converted back to
the number 23, to which 4 is then added.
这个最终的打印数字的结果值为27.这些变量的数字值2和3被转换成字符和合并在一起,并且结果字符串
被转换回成23,加上4的值。
demands it. For example, if the value of either foo or bar in the expression foo + bar happens to
be a string, it is converted to a number before the addition is performed. If numeric values appear
in string concatenation, they are converted to strings. Consider this:
译:字符串转换成数字,和数字转换成字符串,当AWK程序的上下文环境需要它时。比如值是
“foo"或"bar"在表达式中foo+bar将变成一个字符串,它被转换成数字在执行加法运算前。如果数字
字符出现在字符串的合并中,它们将会被转成字符串。如下:
two = 2; three = 3
print (two three) + 4
This eventually prints the (numeric) value 27. The numeric values of the variables two and three
are converted to strings and concatenated together, and the resulting string is converted back to
the number 23, to which 4 is then added.
这个最终的打印数字的结果值为27.这些变量的数字值2和3被转换成字符和合并在一起,并且结果字符串
被转换回成23,加上4的值。
相关文章推荐
- Leetcode201(Bitwise AND of Numbers Range)
- Exchange the numbers of row and array of a two-dimensional array, and form a new two-dimensional ar
- Bitwise AND of Numbers Range——LeetCode
- [LeetCode 201] Bitwise AND of Numbers Range
- Bitwise AND of Numbers Range
- [Leetcode 201, Medium] Bitwise AND of Numbers Range
- 每日一命令(13)free - (Display amount of free and used memory in the system)
- LeetCode解题报告—— Number of Islands & Bitwise AND of Numbers Range
- type conversion of array and pointer in C(2)
- [leetcode][bit] Bitwise AND of Numbers Range
- [Leetcode] Bitwise And of numbers range
- Codeforces Round #432 (Div. 1): B. Arpa and a list of numbers
- Codeforces 851 D. Arpa and a list of numbers(技巧)
- Given two strings s and t, write a function to determine if t is an anagram of s.
- Bitwise AND of Numbers Range - LeetCode 201
- LeetCode "Bitwise AND of Numbers Range"
- LeetCode - Bitwise AND of Numbers Range
- Bitwise AND of Numbers Range——LeetCode
- leetcode:Bitwise AND of Numbers Range
- Bitwise_AND_of_Numbers_Range