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 #85694 is a reply to message #85693] Tue, 27 August 2013 16:11 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
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

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
[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:33:36 PDT 2025

Total time taken to generate the page: 0.00447 seconds