Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4736

SDK • Get Substrings using Delimiter

$
0
0
As efficiently as possible, and possibly leveraging the string.h library, I am trying to figure out how to extract substrings in a string using a delimiter to find the end of the substring.
For example, I'll have a string "This Is My String\nAnother Line\nYet another line" which has '\n' as the delimiter or end of string.
I want to be able to find the '\n' and extract the substring before it
So for each iteration, I'd like to get substrings:
"This Is My String"
"Another Line"
"Yet another line"

One thing I don't get is examples I've seen using the functions in the string library, the return value of the string functions aren't used, instead it appears the string pointers sent to the function seem to get altered.

Statistics: Posted by DanMan32 — Sat Mar 09, 2024 9:38 pm — Replies 1 — Views 29



Viewing all articles
Browse latest Browse all 4736

Trending Articles