Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need some string manipulation help
Message
From
30/06/2008 16:31:05
Mike Sue-Ping
Cambridge, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01327713
Message ID:
01327727
Views:
9
Thanks Hugo!

Your solution was easy. Now I just have to figure out how STUFF() works :)


>Hi Mike,
>
>What about using Stuff()?
>
>
>m.lcData = "0*0*0*0*0*0*0*0*0*0*0*0*"
>
>create cursor c_test (month I, cnt I)
>
>insert into c_test values (4, 129) &&   (April has 129 occurences)
>insert into c_test values (8, 44) &&   (August has 44 occurences)
>insert into c_test values (12, 1) &&   (December has 1 occurence)
>
>
>scan
>	m.lcData		= Stuff(m.lcData, At('*', m.lcData, c_test.month) - 1, 1, Transform(c_test.cnt))
>endscan
>? m.lcData
>
>
>Or you can build the string from scratch, not sure which is better.
>
>[Update]
>Building from scratch would be like this
>
>lcData			= ''
>go top in c_test
>for lnMonth = 1 to 12
>	if lnMonth = c_test.month
>		lcData			= lcData + Transform(c_test.cnt) + '*'
>		skip in c_test
>	else
>		lcData			= lcData + '0*'
>	endif
>next lnMonth
>
>? m.lcData
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform