Breaking a Text String into individual words.

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
Skyfall
Posts: 32
Joined: 06 Aug 2017 16:31

Breaking a Text String into individual words.

#1 Post by Skyfall » 02 Oct 2020 00:11

I am using the MikroBasic PIC32 compiler.
Wondering what is the best way of identifying the words within a text string.
For example: Text = "How now Brown cow <crlf>", and end up with something like this:
A = "How"
B= "now"
C="Brown"
D="cow"

Any help to get started would be appreciated!

Thank you!

David.

mikahawkins
Posts: 5
Joined: 19 Sep 2020 07:44

Re: Breaking a Text String into individual words.

#2 Post by mikahawkins » 02 Oct 2020 06:06

Write a function to tokenize the string whenever the space keyword comes. Then print all the words in different lines. Since, the sentence will be saved in a char array so you can use condition for going to the next line whenever space i.e. " ", comes in.
Mika HAwkins

Skyfall
Posts: 32
Joined: 06 Aug 2017 16:31

Re: Breaking a Text String into individual words.

#3 Post by Skyfall » 09 Oct 2020 13:44

Thanks for the advice, will give it a go!

Has anyone else been down this road, and can post example code?

Thanks again!

Post Reply

Return to “mikroBasic PRO for PIC32 General”