code:
1
2
3
4
5
6
| BEGIN { iarray["Blabla"] = 1; ivalue="BLABLA"; IGNORECASE=1; printf "found value as %d\n", iarray[ivalue]; } |
geeft geen 1, terwijl ik dat wel zou verwachten. Zie ik iets over het hoofd? Werkt IGNORECASE niet op deze manier? Dat is wel flink onhandig...
Bah, na enig zoekwerk vond ik
https://www.gnu.org/softw...dex-IGNORECASE-variable-2
wat onhandig.The value of IGNORECASE has no effect upon array subscripting. The identical string value used to store an array element must be used to retrieve it. When awk creates an array (e.g., with the split() built-in function), that array’s indices are consecutive integers starting at one. (See String-Manipulation Functions.)
[ Voor 44% gewijzigd door thunder7 op 28-11-2022 18:02 ]
hout-nerd - www.hetmooistehout.nl of www.houtenschalen.nl