Hi,
In Java you can use "\n" as a symbol for a new line in a text string.
How do you this in rexx ?
I do it like this :
text = "This is line 1"d2c(10)"This is line 2"
say text
Can I do this in a simpler and nicer way ?
Thanks,
�smund
|
|
0
|
|
|
|
Reply
|
joppe
|
6/4/2006 4:19:21 PM |
|
joppe ha escrito:
> Hi,
>
> In Java you can use "\n" as a symbol for a new line in a text string.
> How do you this in rexx ?
REXX (and Object REXX) hasn't scape sequences.
> text = "This is line 1"d2c(10)"This is line 2"
> say text
>
> Can I do this in a simpler and nicer way ?
eol = d2c(10) /* or eol = '0a'x */
text = "This is line 1" || eol || "This is line 2"
say text
Also you can make a special function for this purpose (and you can
add other scape sequences like \t):
text = scape("This is line 1\nThis is line 2")
say text
exit
scape: procedure
return changestr('\n', arg(1), '0a'x)
This is valid only for UNIX-like (Linux, BeOS...) systems: eol =
'0a'x (linefeed). In Mac systems: eol = '0d'x (carriage return). In
DOS-like systems (DOS, Windows, OS/2): eol = '0d0a'x. (The scape
sequence "\n" can be one of this options.)
In Object REXX there are another way, but this is other story.
Best regards:
Salvador Parra Camacho.
|
|
0
|
|
|
|
Reply
|
Salvador
|
6/4/2006 4:53:20 PM
|
|
joppe wrote:
> In Java you can use "\n" as a symbol for a new line in a text string.
> How do you this in rexx ?
>
> I do it like this :
>
> text = "This is line 1"d2c(10)"This is line 2"
> say text
>
> Can I do this in a simpler and nicer way ?
As Salvador suggests you can do this more tidily, but perhaps you should
look at why you want to do this in the first place. If you are building
multi-line output for single say later, perhaps you should do one of the
following instead:
a) Use say on each piece, e.g.
say "This is line 1"
say "This is line 2"
b) Build a stem and say them later, e.g.
text.1 = "This is line 1"
text.2 = "This is line 2"
text.0 = 2
....
do i = 1 to text.0
say text.i
end
Both of these have the advantage of being "nicer" and platform
independant too. Also, both these techniques will work if you write a
stream using the lineout function instead of using say.
(Or, to put it another way, don't try to write Java in REXX!)
Graham.
|
|
0
|
|
|
|
Reply
|
Graham
|
6/4/2006 5:24:04 PM
|
|
On 04.06.06 18:53, Salvador Parra Camacho wrote:
> eol = d2c(10) /* or eol = '0a'x */
> text = "This is line 1" || eol || "This is line 2"
> say text
Please note, that REXX provides automatic concatenation of strings.
IMO, the following equivalent line is much better readable:
text = "This is line 1"eol"This is line 2"
or as an alternative, what I prefer the most:
text = ''
text = text"This is line 1"eol
text = text"This is line 2"
--
Andreas Schnellbacher
|
|
0
|
|
|
|
Reply
|
Andreas
|
6/4/2006 6:28:38 PM
|
|
Andreas Schnellbacher ha escrito:
> Please note, that REXX provides automatic concatenation of strings.
Yes, I know it. :)
> IMO, the following equivalent line is much better readable:
>
> text = "This is line 1"eol"This is line 2"
I prefer one method or other depending on the day of the week. ;)
Curiously, PPWizard has problems with implicit concatenation and
Dennis recommends explicit concatenation in REXX code of PPWizard
macros.
> or as an alternative, what I prefer the most:
>
> text = ''
> text = text"This is line 1"eol
> text = text"This is line 2"
What about the following alternative?
text = '' ||,
"This is line 1"eol ||,
"This is line 2"
Best regards:
Salvador Parra Camacho
|
|
0
|
|
|
|
Reply
|
Salvador
|
6/4/2006 7:36:06 PM
|
|
Salvador Parra Camacho wrote:
> joppe ha escrito:
>
>
>>Hi,
>>
>>In Java you can use "\n" as a symbol for a new line in a text string.
>>How do you this in rexx ?
>
>
> REXX (and Object REXX) hasn't scape sequences.
Anyone know if the Arexx BIF will do '\r', etc. as they did on the Amiga?
|
|
0
|
|
|
|
Reply
|
Eric
|
6/4/2006 11:22:13 PM
|
|
In
Message-ID:<1149449766.920985.128580@h76g2000cwa.googlegroups.com>,
"Salvador Parra Camacho" <sparrac@gmail.com> wrote:
>> Please note, that REXX provides automatic concatenation of strings.
>
> Yes, I know it. :)
>
>> IMO, the following equivalent line is much better readable:
>>
>> text = "This is line 1"eol"This is line 2"
>
> I prefer one method or other depending on the day of the week. ;)
Yes. Here we're getting into preferences because both are
correct.
My preference is Salvador's origninal:
> text = "This is line 1" || eol || "This is line 2"
When I see text on both sides of a quote mark, it takes time
to parse out (mentally) which is being quoted and which is outside
the quotes. Using concatenation marks makes it obvious. I do use
the automatic concatenation when I want the automatic space
between.
Speaking of style, though, I've begun to use single quotes
instead of double. That way, my programs can be fairly
consistent, even when I need to include the double-quotes that
delimit filenames which contain spaces.
--
Arthur T. - ar23hur "at" intergate "dot" com
Looking for a good MVS systems programmer position
|
|
0
|
|
|
|
Reply
|
Arthur
|
6/5/2006 3:02:13 AM
|
|
Hi everyone !
Thanks for all the tips - and quick response !
Best regrads �smund
joppe wrote:
> Hi,
>
> In Java you can use "\n" as a symbol for a new line in a text string.
> How do you this in rexx ?
>
> I do it like this :
>
> text = "This is line 1"d2c(10)"This is line 2"
> say text
>
> Can I do this in a simpler and nicer way ?
>
> Thanks,
>
> �smund
|
|
0
|
|
|
|
Reply
|
joppe
|
6/5/2006 9:19:41 AM
|
|
|
7 Replies
244 Views
(page loaded in 0.463 seconds)
Similiar Articles: Multiple Line Text in GUI Axes - comp.soft-sys.matlabMy current GUI only consist of two axes, two push button and a static text. ... Multiple line push button string ... browser image "Graphical User Interface ... find string in file - comp.unix.shellDear all, I have several files containing just one line and each line contains different characters separated by blank spaces: xxxxx/xxx --xx xx ... how to comment out multiple lines in kshell? - comp.unix ...Multiple line plots, two y axes - comp.soft-sys.matlab ... Multiline property of an edit box to enable multiple | lines ... include it in your project directly, find string ... sed replace string when line match something - comp.unix.shell ...regex match multiple words in a line - comp.databases.mysql ... sed replace string when line match something - comp.unix.shell ... regex match multiple words in a line ... multiple lines in static text - comp.soft-sys.matlab> Hi, > > the line > set(handles.text1,'String',[A;B;C;D;E;F;G;H;I;J;K;L]); > creates a char array [A;B;C;D;E;F;G;H;I;J;K;L] > this is only possible if all of the ... Parsing multiple lines with regex - comp.lang.java.programmer ...... directly following my searched line.If I could make bigregex that included several lines ... Any ideas?>while (scanner.hasNext()) { for (int i = 0; i < 4; i++) { String ... Put to split a string into two lines ? - comp.soft-sys.sas ...Re: Put to split a string into two lines ? - comp.soft-sys ... how to merge multiple lines into one line - comp.lang.awk ... Put to split a string into two lines ? - comp ... Shortest way to read all lines (one by one) from a text file ...try { for( String line; (line=in.readLine()) != null; System.out.println(line ... read all lines (one by one) from a text file ..... because reading in multiple lines ... how to add a newline symbol into a string? - comp.soft-sys.matlab ...I want obtain a string 'abc def' But I don't know how to include a newline ... as a newline, you get the newline you want at the end. ... how to merge multiple lines ... handling multiple lines of input from inputdlg - comp.soft-sys ...handling multiple lines of input from inputdlg - comp.soft-sys ... I'm ... second', I get a single cell of output, formatted as a string, reading ... asm.x86; 0x0004 Line ... Writing a long string in multiple lines – c# | {love to code?}Writing a big string will always produce scrollbars in the editor. So it’s better to split it to multiple lines which is more easy to read. This post ... How to Add Multiple Lines to a String Field in Visual Basic | eHow.comString fields are used in Visual Basic to store data that consist of text information to be printed to the screen or written to a file. For example, the following ... 7/28/2012 7:22:02 PM
|