-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 LeJacq, Jean Pierre wrote: > Any suggestions on how how to determine the length of > a string with just GNU Make functions?
characters := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z characters += a b c d e f g h i j k l m n o p q r s t u v w y z characters += 0 1 2 3 4 5 6 7 8 9 strlen = $(strip $(eval __temp := $(subst $(sp),x,$1))$(foreach a,$(characters),$(eval __temp := $$(subst $a,x,$(__temp))))$(eval __temp := $(subst x,x ,$(__temp)))$(words $(__temp))) Then do: $(call strlen,$(X)) to get the length of X. Clearly, you may need to augment the definition of characters if the string can contain characters other than alphanumerics, but I hope that gives you an idea of how to do it. > If that is possible, is there a way of trimming a string > to a desired length at either end? Left as an exercise for the reader :-) John. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGGlFCLphrp73n/hARAtHEAKCIcisHd7GJDmtDGfdItKjh53rVNACfbT43 EKDd/Hl43Ki9OSlvJQ+Apnw= =iP6a -----END PGP SIGNATURE----- _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
