From c5fbf475a8efa76f67c5e795d6adbb4bb0769ee8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 15 Jan 2016 04:57:02 +0200 Subject: Improve example for asort with comparison function. --- doc/gawktexi.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/gawktexi.in') diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 081e067a..deb212ed 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -26329,10 +26329,9 @@ is true because locale-based comparison occurs only when in POSIX-compatibility mode, and because @code{asort()} and @code{asorti()} are @command{gawk} extensions, they are not available in that case.} -The following example demonstrates the use of a comparison function -with @code{asort()}. The comparison function, -@code{case_fold_compare()}, does a string comparison ignoring case -(by mapping both values to lowercase). +The following example demonstrates the use of a comparison function with +@code{asort()}. The comparison function, @code{case_fold_compare()}, maps +both values to lowercase in order to compare them ignoring case. @example # case_fold_compare --- compare as strings, ignoring case @@ -26363,9 +26362,10 @@ BEGIN @{ asort(data, result, "case_fold_compare") - for (i = 1; i <= 52; i++) @{ + j = length(result) + for (i = 1; i <= j; i++) @{ printf("%s", result[i]) - if (i % 26 == 0) + if (i % (j/2) == 0) printf("\n") else printf(" ") -- cgit v1.2.3