function to create a string

function to create a string

Postby Silvio.Falconi » Tue Dec 12, 2023 1:07 pm

Is there a function to save a string like "30/60/90" from an array?

i.e. to create an array I made aData := hb_ATokens(cString,"/")

Does the reverse function exist?
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: function to create a string

Postby cmsoft » Tue Dec 12, 2023 3:13 pm

No conozco una que te devuelva la inversa, pero podrias usar algo asi:
Code: Select all  Expand view  RUN

#include "fivewin.ch"

function Main()
local cString := "30/60/90", aData := hb_ATokens(cString,"/")

cString := ""
AEval(aData, {|a| cString := cString + a + "/" })
cString := substr(cString,1,len(cString)-1)

? cString
RETURN nil
 
User avatar
cmsoft
 
Posts: 1291
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: function to create a string

Postby nageswaragunupudi » Tue Dec 12, 2023 4:05 pm

Code: Select all  Expand view  RUN
cStr := FW_ArrayAsList( aData, [cDelim], [lTrim]


In this case:
Code: Select all  Expand view  RUN
aData := FW_ListAsArray( "30/60/90", "/" )
? aData
cStr := FW_ArrayAsList( aData, "/" )


Eg.
Code: Select all  Expand view  RUN
? cStr := FW_ArrayAsList( { Date(), "TEXT       ", 234.56 }, ";", .T. )
//--> "12-12-2023;TEXT;234.56"
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: function to create a string

Postby Silvio.Falconi » Tue Dec 12, 2023 4:27 pm

I was convinced there was a function that did the opposite but I really didn't remember, thanks everyone for the help
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: function to create a string

Postby cmsoft » Tue Dec 12, 2023 4:57 pm

Muchas gracias Mr Rao...
Desde que version de Fivewin existen esas funciones?
User avatar
cmsoft
 
Posts: 1291
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: function to create a string

Postby nageswaragunupudi » Tue Dec 12, 2023 6:04 pm

February 2013.
More than 10 years back.

These functions are in \source\function\valtostr.prg.
These functions are extensively used by FWH in its own modules (around 16 modules)
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: function to create a string

Postby cmsoft » Tue Dec 12, 2023 7:51 pm

Excelente! Muchas gracias Mr. Rao!!
User avatar
cmsoft
 
Posts: 1291
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests