FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour function to create a string
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
function to create a string
Posted: Tue Dec 12, 2023 01: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 March-April 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
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: function to create a string
Posted: Tue Dec 12, 2023 03:13 PM
No conozco una que te devuelva la inversa, pero podrias usar algo asi:
Code (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: function to create a string
Posted: Tue Dec 12, 2023 04:05 PM
Code (fw): Select all Collapse
cStr := FW_ArrayAsList( aData, [cDelim], [lTrim]
In this case:
Code (fw): Select all Collapse
aData := FW_ListAsArray( "30/60/90", "/" )
? aData
cStr := FW_ArrayAsList( aData, "/" )
Eg.
Code (fw): Select all Collapse
? cStr := FW_ArrayAsList( { Date(), "TEXT       ", 234.56 }, ";", .T. )
//--> "12-12-2023;TEXT;234.56"
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: function to create a string
Posted: Tue Dec 12, 2023 04: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 March-April 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
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: function to create a string
Posted: Tue Dec 12, 2023 04:57 PM

Muchas gracias Mr Rao...

Desde que version de Fivewin existen esas funciones?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: function to create a string
Posted: Tue Dec 12, 2023 06: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
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: function to create a string
Posted: Tue Dec 12, 2023 07:51 PM

Excelente! Muchas gracias Mr. Rao!!

Continue the discussion