Groups | Search | Server Info | Login | Register
Groups > comp.lang.awk > #9987
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.awk |
| Subject | Re: substr() - copying or not copying, that is here the question. |
| Date | 2025-06-01 15:47 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <101hlls$24vmc$1@dont-email.me> (permalink) |
| References | <101f9oo$18edp$1@dont-email.me> <683b5389$0$683$14726298@news.sunsite.dk> <101fv4s$1g5c8$1@dont-email.me> <87h60zrbea.fsf@bsb.me.uk> <101hevp$2qrh$1@news.xmission.com> |
On 01.06.2025 13:53, Kenny McCormack wrote: > In article <87h60zrbea.fsf@bsb.me.uk>, Ben Bacarisse <ben@bsb.me.uk> wrote: > ... >> An alternative (depending on the context) would be to consider an >> extension that provides an index function with a third argument giving >> the initial offset. I've not looked at how extensions get access to >> GAWK strings, so this many not be as easy as it sounds, but I would >> guess that it might be relatively simple to do. > > The thing about writing GAWK extensions is that the first one is hard, > because it is all new stuff to learn (and you have to establish your own > conventions for how your extensions are going to look, code-wise). [...] You are describing the individual practical accustoming to writing own extensions. Okay. My viewpoint was another. It's IMO a problem if folks write own index() extension in his/her own version and code quality. We see proliferations of own versions in all areas of IT; and I don't see it as a desirable goal. I wouldn't want two (or three) 'match' functions (match(), match_a(), match_ae()) or similar.[*] If a function provides actually the same basic task, and it should get controlled (like program options[**]) with optional arguments, that would be what I'd think be the right way. > > By the way, if you find the substring at position 900005 (i.e., the 5th (*) > char of the searched string), should the function return 5 or 900005? > > (*) Or 6th; I'm not sure of my exact notation at this point. I don't think the decision is crucial since (I think) you could derive one value from the other (provided the given arguments). The behavior should probably be discussed to find the advantages of one or the other option. Yet I'm not sure whether the usefulness of such a match() function extension is commonly accepted. (Anyway. Core evolutions are deprecated. And it won't happen.) Janis [*] I find it already a bit, umm, strange to have three different substitution functions in GNU Awk (two historic/standard and one somewhat generalized and extended). [**] Do we need grep, egrep, fgrep - on my system they are not even hardlinks -, or should grep be used with options grep -E, grep -F ?
Back to comp.lang.awk | Previous | Next — Previous in thread | Next in thread | Find similar
substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-05-31 18:12 +0200
Re: substr() - copying or not copying, that is here the question. mack@the-knife.org (Mack The Knife) - 2025-05-31 19:07 +0000
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-01 00:16 +0200
Re: substr() - copying or not copying, that is here the question. Ben Bacarisse <ben@bsb.me.uk> - 2025-06-01 11:42 +0100
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-01 13:43 +0200
Re: substr() - copying or not copying, that is here the question. gazelle@shell.xmission.com (Kenny McCormack) - 2025-06-01 12:06 +0000
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-01 15:27 +0200
Re: substr() - copying or not copying, that is here the question. gazelle@shell.xmission.com (Kenny McCormack) - 2025-06-01 11:53 +0000
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-01 15:47 +0200
Re: substr() - copying or not copying, that is here the question. gazelle@shell.xmission.com (Kenny McCormack) - 2025-06-01 14:17 +0000
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-08 00:01 +0200
Re: substr() - copying or not copying, that is here the question. mack@the-knife.org (Mack The Knife) - 2025-06-03 06:56 +0000
Re: substr() - copying or not copying, that is here the question. gazelle@shell.xmission.com (Kenny McCormack) - 2025-06-03 11:04 +0000
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-08 00:05 +0200
Re: substr() - copying or not copying, that is here the question. mack@the-knife.org (Mack The Knife) - 2025-06-08 12:35 +0000
Re: substr() - copying or not copying, that is here the question. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-11 11:07 +0200
Meta chat (Was: substr() - copying or not copying, that is here the question.) gazelle@shell.xmission.com (Kenny McCormack) - 2025-06-11 12:11 +0000
Re: substr() - copying or not copying, that is here the question. Kaz Kylheku <643-408-1753@kylheku.com> - 2025-06-01 00:01 +0000
csiph-web