break a text into words

break a text into words

Postby Silvio.Falconi » Wed Apr 06, 2022 10:55 am

I have this text

Code: Select all  Expand view
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


and I wish break a text into words and create an array and insert these words in this array
how could I do ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: break a text into words

Postby MarcoBoschi » Wed Apr 06, 2022 11:02 am

Code: Select all  Expand view

FUNCTION MAIN()
LOCAL ctesto
LOCAL i
LOCAL aTesto
cTesto := "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
cTesto := STRTRAN( cTesto , "." , "" )
cTesto := STRTRAN( cTesto , "," , "" )

aTesto := HB_ATokens( cTesto, " " )

RETURN NIL
 
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: break a text into words

Postby Silvio.Falconi » Wed Apr 06, 2022 11:54 am

MarcoBoschi wrote:
Code: Select all  Expand view

FUNCTION MAIN()
LOCAL ctesto
LOCAL i
LOCAL aTesto
cTesto := "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
cTesto := STRTRAN( cTesto , "." , "" )
cTesto := STRTRAN( cTesto , "," , "" )

aTesto := HB_ATokens( cTesto, " " )

RETURN NIL
 


thanks
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 84 guests

cron