Silvio.Falconi wrote:yes I know len function
But U perhaps not understood what I wish.
I explain you
I have a string of n character (I not Know the Len of this string)
I wish create a simply array with a string of 20 character each
sample :
aadd( atext,"12345678901234567890")
aadd( atext,"12345678901234567890")
aadd( atext,"12345678901234567890")
the strings must be 20 charactes
for a sample : I hace a string
len( cstring) := 41
I must create 3 record ( 2 of 20 cr and 1 of 1 cr)
but this one must be of 1 cr + space(19)
allway 20 cr
aText:= Array()
FOR i:= 1 TO Len( cMessage ) STEP 20
aAdd( aText, PadR( SubStr( cMessage, i, 20 ), 20) ) // Edited
NEXT
local cMessage:= "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
local i,n
local aTextLinea := {}
cMessage := PadR( cMessage, ( n := Ceiling( Len( cMessage ) / 20 ) * 20 ) )
for i := 1 to n step 20
AAdd( aTextLinea, SubStr( cMessage, i, 20 ) )
next
pieter wrote:Yes, I was also doing something with substr(), the code Carlos Mora has send works almost, but if I run this code, I see that there still is a problem at the end.
I will think about it further.
Pieter
If Len( aTail( aText ) ) != 20
aText[ Len(aText) ] := PadR( aText[ Len(aText) ], 20 )
ENDIF
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 104 guests