comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Adding values to a string
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Adding values to a string [message #49037] Thu, 08 June 2006 13:44 Go to previous message
rafaloos is currently offline  rafaloos
Messages: 15
Registered: January 2006
Junior Member
It works perfectly ...
Thank you very much for the fast reply


Rick Towler wrote:
> One way:
>
> text='M5A,060530,181005,4302003340bf,1149012,,,,,15.70765,89 3.439514,7.73610973'
>
> IDL> parts=STRSPLIT(text, ',', /EXTRACT, /PRESERVE_NULL)
> IDL> parts[WHERE(parts eq '')] = '0'
> IDL> newText = STRJOIN(parts, ',', /SINGLE)
> IDL> print, newText
> M5A,060530,181005,4302003340bf,1149012,0,0,0,0,15.70765,893. 439514,7.73610973
>
> -Rick
>
> rafaloos@gmail.com wrote:
>> Hi ...
>> I have a string like this:
>>
>> 'M5A,060530,181005,4302003340bf,1149012,,,,,15.70765,893.439 514,7.73610973'
>>
>> As you can see this string has some extra commas. Values were supposed
>> to be in between these commas, but they are not.
>>
>> I want to ADD some zeros in the above string so that in the end my
>> string will be like this:
>>
>> 'M5A,060530,181005,4302003340bf,1149012,0,0,0,0,15.70765,893 .4395141,7.73610973'
>>
>> Is there a easy way to do that ?
>>
>> Thank you
>>
[Message index]
 
Read Message
Read Message
Previous Topic: Adding values to a string
Next Topic: contouring data over a map

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:50:48 PDT 2025

Total time taken to generate the page: 0.00396 seconds