theLineInThisLoop = theLineInThisLoop.strip(B,"\t")
this doesn't work. TIA _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Can you parse on the 'tab' character?
Bob Hamilton Richardson Texas USA On Tue, Jan 8, 2013 at 1:49 PM, Kenneth Klein (TEMA TPC) <[hidden email]> wrote: > theLineInThisLoop = theLineInThisLoop.strip(B,"\t") > > > this doesn't work. > > TIA > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by kenner
> theLineInThisLoop = theLineInThisLoop.strip(B,"\t") > > this doesn't work. It should do. Perhaps you have a variable B with a value that is not one of the expected options for the strip method? If that's not the problem, do please post a more concrete example showing an input string with leading and/or trailing tabs that this does not work for. Mike _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
/* netrexx */
s = " hello" "\t" "\t" ss = s.strip() say '>'ss'<' results in: NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337 Copyright (c) RexxLA, 2011. All rights reserved. Parts Copyright (c) IBM Corporation, 1995,2008. Program hello.nrx ===== Exec: hello ===== >hello < Processing of 'hello.nrx' complete The leading blank is stripped but the trailing tabs and blanks are not. On 1/8/2013 3:49 PM, Mike Cowlishaw wrote: > >> theLineInThisLoop = theLineInThisLoop.strip(B,"\t") >> >> this doesn't work. > It should do. Perhaps you have a variable B with a value that is not one of the > expected options for the strip method? > > If that's not the problem, do please post a more concrete example showing an > input string with leading and/or trailing tabs that this does not work for. > > Mike _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by kenner
/* netrexx */
s = " hello\t\t" ss = s.strip('B','\t') say '>'s'<' say '>'ss'<' java striptab gives > hello < > hello< note the blanks in your source ---- Bill Fenlason <[hidden email]> schrieb: > /* netrexx */ > s = " hello" "\t" "\t" > ss = s.strip() > say '>'ss'<' > > results in: > > NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337 > Copyright (c) RexxLA, 2011. All rights reserved. > Parts Copyright (c) IBM Corporation, 1995,2008. > Program hello.nrx > ===== Exec: hello ===== > >hello < > Processing of 'hello.nrx' complete > > The leading blank is stripped but the trailing tabs and blanks are not. > > > On 1/8/2013 3:49 PM, Mike Cowlishaw wrote: > > > >> theLineInThisLoop = theLineInThisLoop.strip(B,"\t") > >> > >> this doesn't work. > > It should do. Perhaps you have a variable B with a value that is not one of the > > expected options for the strip method? > > > > If that's not the problem, do please post a more concrete example showing an > > input string with leading and/or trailing tabs that this does not work for. > > > > Mike > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by kenner
Did you remember, if theLineInThisLoop is a result of an I/O operation, to cast the line to a Rexx type?
On 8 jan. 2013, at 20:49, "Kenneth Klein (TEMA TPC)" <[hidden email]> wrote: > theLineInThisLoop = theLineInThisLoop.strip(B,"\t") > > > this doesn't work. > > TIA > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by christel.u.w.pachl christel.u.w.pachl
I've again demonstrated the old adage: "Engage brain before hitting
send", and I wrongly assumed that the treatment of tabs at run time was the same as at source time. My example was to demonstrate that strip() should strip the sequence "blank-tab-blank-tab", which it clearly does not. (The imbedded blanks were intentional) Page 44 of the language ref says "For implementations that support tabulation (tab) and form feed characters, these characters outside of literal strings are treated as if they were a single blank;", and page 27 in the description of methods includes "• strip (remove leading and/or trailing white space)", implying in my mind (wrong assumption) that it treats tabs as blanks. The formal definition of strip() on page 166 clarifies the issue. Again - sorry for the confusion - my bad. The issue of tab and blank equality at run time might be easily handled if the second argument of strip() allowed multi-character strings so that: pad = ' ' || '\t'; strip('B', pad) could be used to strip conventional whitespace, etc., but such is not the case. On 1/8/2013 4:14 PM, Walter Pachl wrote: > /* netrexx */ > s = " hello\t\t" > ss = s.strip('B','\t') > say '>'s'<' > say '>'ss'<' > > java striptab gives > >> hello < >> hello< > note the blanks in your source > > > ---- Bill Fenlason <[hidden email]> schrieb: >> /* netrexx */ >> s = " hello" "\t" "\t" >> ss = s.strip() >> say '>'ss'<' >> >> results in: >> >> NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337 >> Copyright (c) RexxLA, 2011. All rights reserved. >> Parts Copyright (c) IBM Corporation, 1995,2008. >> Program hello.nrx >> ===== Exec: hello ===== >> >hello < >> Processing of 'hello.nrx' complete >> >> The leading blank is stripped but the trailing tabs and blanks are not. >> >> >> On 1/8/2013 3:49 PM, Mike Cowlishaw wrote: >>> >>>> theLineInThisLoop = theLineInThisLoop.strip(B,"\t") >>>> >>>> this doesn't work. >>> It should do. Perhaps you have a variable B with a value that is not one of the >>> expected options for the strip method? >>> >>> If that's not the problem, do please post a more concrete example showing an >>> input string with leading and/or trailing tabs that this does not work for. >>> >>> Mike >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] >> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ >> > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2013.0.2805 / Virus Database: 2637/5989 - Release Date: 12/26/12 > Internal Virus Database is out of date. > > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Why propose a language change when NetRexx already has BIFs to handle
such things? It is trivial to treat tabs and form feeds in literals as blanks if needed: ------------------------------------------------ /* netrexx */ s = " hello" "\t" "\t" ss = s.translate(' ','\t\f').strip() say '>'ss'<' ------------------------------------------------ -- Kermit On 1/8/2013 2:52 PM, Bill Fenlason wrote: > I've again demonstrated the old adage: "Engage brain before hitting > send", and I wrongly assumed that the treatment of tabs at run time > was the same as at source time. > > My example was to demonstrate that strip() should strip the sequence > "blank-tab-blank-tab", which it clearly does not. (The imbedded > blanks were intentional) > > Page 44 of the language ref says "For implementations that support > tabulation (tab) and form feed characters, these characters outside of > literal strings are treated as if they were a single blank;", and page > 27 in the description of methods includes "• strip (remove leading > and/or trailing white space)", implying in my mind (wrong assumption) > that it treats tabs as blanks. > > The formal definition of strip() on page 166 clarifies the issue. > > Again - sorry for the confusion - my bad. > > The issue of tab and blank equality at run time might be easily > handled if the second argument of strip() allowed multi-character > strings so that: pad = ' ' || '\t'; strip('B', pad) could be used to > strip conventional whitespace, etc., but such is not the case. > > > On 1/8/2013 4:14 PM, Walter Pachl wrote: >> /* netrexx */ >> s = " hello\t\t" >> ss = s.strip('B','\t') >> say '>'s'<' >> say '>'ss'<' >> >> java striptab gives >> >>> hello < >>> hello< >> note the blanks in your source >> >> >> ---- Bill Fenlason <[hidden email]> schrieb: >>> /* netrexx */ >>> s = " hello" "\t" "\t" >>> ss = s.strip() >>> say '>'ss'<' >>> >>> results in: >>> >>> NetRexx portable processor, version NetRexx 3.01RC2, build >>> 1-20110925-2337 >>> Copyright (c) RexxLA, 2011. All rights reserved. >>> Parts Copyright (c) IBM Corporation, 1995,2008. >>> Program hello.nrx >>> ===== Exec: hello ===== >>> >hello < >>> Processing of 'hello.nrx' complete >>> >>> The leading blank is stripped but the trailing tabs and blanks are not. >>> >>> >>> On 1/8/2013 3:49 PM, Mike Cowlishaw wrote: >>>>> theLineInThisLoop = theLineInThisLoop.strip(B,"\t") >>>>> >>>>> this doesn't work. >>>> It should do. Perhaps you have a variable B with a value that is >>>> not one of the >>>> expected options for the strip method? >>>> >>>> If that's not the problem, do please post a more concrete example >>>> showing an >>>> input string with leading and/or trailing tabs that this does not >>>> work for. >>>> >>>> Mike >>> _______________________________________________ >>> Ibm-netrexx mailing list >>> [hidden email] >>> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ >>> >> >> >> ----- >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2013.0.2805 / Virus Database: 2637/5989 - Release Date: >> 12/26/12 >> Internal Virus Database is out of date. >> >> > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
BTW: If you want to leave interior tabs/ffs alone and only remove
leading and trailing ones, the expression to do so is slightly more complex: ---------------------------------------------- /* netrexx */ s = " hello \t there" "\t" "\t" ss = s.translate(' ','\t\f').strip() say '>'ss'<' sss=s.reverse.substr(s.reverse.verify(' \t\f')).reverse.substr(s.reverse.substr(s.reverse.verify(' \t\f')).reverse.verify(' \t\f')) say '>'sss'<' ---------------------------------------------- -- Kermit On 1/8/2013 3:39 PM, Kermit Kiser wrote: > Why propose a language change when NetRexx already has BIFs to handle > such things? It is trivial to treat tabs and form feeds in literals as > blanks if needed: > > ------------------------------------------------ > /* netrexx */ > s = " hello" "\t" "\t" > ss = s.translate(' ','\t\f').strip() > say '>'ss'<' > ------------------------------------------------ > > -- Kermit > > On 1/8/2013 2:52 PM, Bill Fenlason wrote: >> I've again demonstrated the old adage: "Engage brain before hitting >> send", and I wrongly assumed that the treatment of tabs at run time >> was the same as at source time. >> >> My example was to demonstrate that strip() should strip the sequence >> "blank-tab-blank-tab", which it clearly does not. (The imbedded >> blanks were intentional) >> >> Page 44 of the language ref says "For implementations that support >> tabulation (tab) and form feed characters, these characters outside >> of literal strings are treated as if they were a single blank;", and >> page 27 in the description of methods includes "• strip (remove >> leading and/or trailing white space)", implying in my mind (wrong >> assumption) that it treats tabs as blanks. >> >> The formal definition of strip() on page 166 clarifies the issue. >> >> Again - sorry for the confusion - my bad. >> >> The issue of tab and blank equality at run time might be easily >> handled if the second argument of strip() allowed multi-character >> strings so that: pad = ' ' || '\t'; strip('B', pad) could be used >> to strip conventional whitespace, etc., but such is not the case. >> >> >> On 1/8/2013 4:14 PM, Walter Pachl wrote: >>> /* netrexx */ >>> s = " hello\t\t" >>> ss = s.strip('B','\t') >>> say '>'s'<' >>> say '>'ss'<' >>> >>> java striptab gives >>> >>>> hello < >>>> hello< >>> note the blanks in your source >>> >>> >>> ---- Bill Fenlason <[hidden email]> schrieb: >>>> /* netrexx */ >>>> s = " hello" "\t" "\t" >>>> ss = s.strip() >>>> say '>'ss'<' >>>> >>>> results in: >>>> >>>> NetRexx portable processor, version NetRexx 3.01RC2, build >>>> 1-20110925-2337 >>>> Copyright (c) RexxLA, 2011. All rights reserved. >>>> Parts Copyright (c) IBM Corporation, 1995,2008. >>>> Program hello.nrx >>>> ===== Exec: hello ===== >>>> >hello < >>>> Processing of 'hello.nrx' complete >>>> >>>> The leading blank is stripped but the trailing tabs and blanks are >>>> not. >>>> >>>> >>>> On 1/8/2013 3:49 PM, Mike Cowlishaw wrote: >>>>>> theLineInThisLoop = theLineInThisLoop.strip(B,"\t") >>>>>> >>>>>> this doesn't work. >>>>> It should do. Perhaps you have a variable B with a value that is >>>>> not one of the >>>>> expected options for the strip method? >>>>> >>>>> If that's not the problem, do please post a more concrete example >>>>> showing an >>>>> input string with leading and/or trailing tabs that this does not >>>>> work for. >>>>> >>>>> Mike >>>> _______________________________________________ >>>> Ibm-netrexx mailing list >>>> [hidden email] >>>> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ >>>> >>> >>> >>> ----- >>> No virus found in this message. >>> Checked by AVG - www.avg.com >>> Version: 2013.0.2805 / Virus Database: 2637/5989 - Release Date: >>> 12/26/12 >>> Internal Virus Database is out of date. >>> >>> >> >> _______________________________________________ >> Ibm-netrexx mailing list >> [hidden email] >> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ >> > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |