05-30-2023, 09:15 PM
Ok, I have get this right now. Let's see if this can also be integrated into Basic. That would be good, because in QB64 it's far too complicated.
In C and Java (even easier) one have it. Why reinvent the wheel? I think it would be much easier for the developers to allow access to a C or Java routine from Basic.
Well, I'm not a developer. It's just an idea.
In C and Java (even easier) one have it. Why reinvent the wheel? I think it would be much easier for the developers to allow access to a C or Java routine from Basic.
Well, I'm not a developer. It's just an idea.
Code: (Select All)
//Beispiel aus: https://www.proggen.org/doku.php?id=c:lib:string:strtok
//Zeichenkette zerlegen in ihre einzelnen Wörter - 30. Mai 2023
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100
int main(void)
{
char zk[] = "They never came back!";
char zk2[MAX];
char gesuchtes_zeichen[] = " ";
char *teil_wort;
int wort = 1;
//Zeichenkette in eine andere kopieren
//funktioniert nur so.
strcpy(zk2, zk);
printf ("Zerlege Text: %s\n", zk );
teil_wort = strtok(zk, gesuchtes_zeichen);
while(teil_wort)
{
printf("Wort%2d: %s\n", wort++, teil_wort);
teil_wort = strtok(NULL, gesuchtes_zeichen);
}
printf("\nAusgabe aufgeteilter Text: %s\n", zk2);
return(0);
}