Question

I'm interested in something like strstr() function but that I could pass a formatted string as argument, like what I pass to printf(). To be clear, let's get an example:

Suppose that I want to find this text: "abc:123" where abc could be any string with any size followed by ':' and then followed by some integer number. I suppose a good function could receive as argument something like this: "%s:%d".

Something else, I want to use this embedded, so I can't get big and/or esoteric libraries.

Thanks and best regards!

Was it helpful?

Solution 3

Gentleman,

I found this CRX and it is exactly what I wanted. Thanks everybody!

OTHER TIPS

You can use sscanf. It takes a string and a format as input and you fill variables as a result. Regular expressions are also something to consider

Use should use regular expressions.

This thread may help you: Compiling/Matching POSIX Regular Expressions in C

Alternatively, you can directly use printf function. The function outputs strings on default uart (mine is uart0).

But prior to using printf, proper set-up and configuration is required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top