The 1992 POSIX standard introduced the concept of a numeric string, which is simply a string that looks like a number—for example, " +2". This concept is used for determining the type of a variable. The type of the variable is important because the types of two variables determine how they are compared. In gawk, variable typing follows these rules:
* A numeric constant or the result of a numeric operation has the numeric attribute.
* A string constant or the result of a string operation has the string attribute.
* Fields, getline input, FILENAME, ARGV elements, ENVIRON elements, and the elements of an array created by split that are numeric strings have the strnum attribute. Otherwise, they have the string attribute. Uninitialized variables also have the strnum attribute.
* Attributes propagate across assignments but are not changed by any use.
阅读(2050) | 评论(0) | 转发(0) |