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

Home » Public Forums » archive » concatenating strings
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: concatenating strings [message #85695 is a reply to message #85694] Tue, 27 August 2013 16:31 Go to previous messageGo to previous message
Seb is currently offline  Seb
Messages: 15
Registered: January 2006
Junior Member
On Tue, 27 Aug 2013 17:11:48 -0600,
Michael Galloy <mgalloy@gmail.com> wrote:

> On 8/27/13 4:56 PM, Seb wrote:
>> Hi,

>> I just began learning IDL, and am not understanding why the following
>> is not producing the string (20111021):

>> ---<--------------------cut
>> here---------------start------------------->---
IDL> caldat, julday(1, 294, 2011), mon, day, year
>> % Compiled module: CALDAT.
IDL> print, year, mon, day
>> 2011 10 21
IDL> print, string(year) + string(mon) + string(day)
>> 2011 10 21 ---<--------------------cut
>> here---------------end--------------------->---

>> I thought that the string() function would coerce the numbers to a
>> string, and then the concatenation operator ('+') would join them
>> together, but this is not happening. What am I missing?

>> Cheers,


> It is happening, but the individual strings that are being created are
> being created with the default formatting (with leading spaces). Try:

IDL> print, strtrim(year, 2) + strtrim(mon, 2) + strtrim(day, 2)
> 20111021

Thank you. So the leading spaces are created by the 'caldat' function
when it outputs the variables, right?


--
Seb
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What subprogram? What parameters and keywords?
Next Topic: Emacs IDLWAVE

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

Current Time: Wed Oct 08 19:18:18 PDT 2025

Total time taken to generate the page: 0.00446 seconds