------ extPart_000_0159_01C4A198.2ABFF2A0 Content-Type: text/plain; charset so-8859-1" Content-Transfer-Encoding: 7bit <Ara.T.Howard / noaa.gov> schrieb im Newsbeitrag news:Pine.LNX.4.60.0409230933170.2168 / harp.ngdc.noaa.gov... > On Thu, 23 Sep 2004, Robert Klemme wrote: > > > > > "ts" <decoux / moulon.inra.fr> schrieb im Newsbeitrag > > news:200409231451.i8NEphE08333 / moulon.inra.fr... > >>>>>>> "A" Ara T Howard <Ara.T.Howard / noaa.gov> writes: > >> > >> A> if s.strip.empty? > >> A> # the string is whitespace only > >> > >> svg% ruby -e 'a \000\000"; p "OK" if a.strip.empty?' > >> "OK" > >> svg% > >> > >> svg% ruby -e 'a \000\000 "; p "OK" if a.strip.empty?' > >> svg% > > > > Also I'd say the disadvantage of "a.strip.empty?" is that it creates a copy > > of the string ( a new instance) which is generally slower than a simple > > regexp check. > > i assumed you were correct - but this is suprising: I have different results: user system total real rx s 0.031000 0.000000 0.031000 ( 0.023000) rx bs 0.016000 0.000000 0.016000 ( 0.022000) rx !~ s 0.031000 0.000000 0.031000 ( 0.025000) rx !~ bs 0.016000 0.000000 0.016000 ( 0.027000) RX1 s 0.031000 0.000000 0.031000 ( 0.030000) RX1 bs 0.031000 0.000000 0.031000 ( 0.030000) RX2 !~ s 0.047000 0.000000 0.047000 ( 0.039000) RX2 !~ bs 0.032000 0.000000 0.032000 ( 0.033000) s rx 0.031000 0.000000 0.031000 ( 0.024000) bs rx 0.015000 0.000000 0.015000 ( 0.024000) s !~ rx 0.032000 0.000000 0.032000 ( 0.026000) bs !~ rx 0.031000 0.000000 0.031000 ( 0.026000) s RX1 0.031000 0.000000 0.031000 ( 0.031000) bs RX1 0.031000 0.000000 0.031000 ( 0.031000) s !~ RX2 0.032000 0.000000 0.032000 ( 0.030000) bs !~ RX2 0.031000 0.000000 0.031000 ( 0.034000) s.strip.empty? 0.062000 0.000000 0.062000 ( 0.054000) bs.strip.empty? 0.047000 0.000000 0.047000 ( 0.050000) user system total real rx s 0.032000 0.000000 0.032000 ( 0.022000) rx bs 0.015000 0.000000 0.015000 ( 0.023000) rx !~ s 0.031000 0.000000 0.031000 ( 0.024000) rx !~ bs 0.016000 0.000000 0.016000 ( 0.025000) RX1 s 0.031000 0.000000 0.031000 ( 0.030000) RX1 bs 0.032000 0.000000 0.032000 ( 0.031000) RX2 !~ s 0.031000 0.000000 0.031000 ( 0.031000) RX2 !~ bs 0.031000 0.000000 0.031000 ( 0.032000) s rx 0.031000 0.000000 0.031000 ( 0.025000) bs rx 0.032000 0.000000 0.032000 ( 0.024000) s !~ rx 0.015000 0.000000 0.015000 ( 0.028000) bs !~ rx 0.031000 0.000000 0.031000 ( 0.026000) s RX1 0.032000 0.000000 0.032000 ( 0.032000) bs RX1 0.015000 0.000000 0.015000 ( 0.031000) s !~ RX2 0.032000 0.000000 0.032000 ( 0.031000) bs !~ RX2 0.031000 0.000000 0.031000 ( 0.033000) s.strip.empty? 0.062000 0.000000 0.062000 ( 0.051000) bs.strip.empty? 0.047000 0.000000 0.047000 ( 0.048000) 18:05:36 [ruby]: Regards robert ------ extPart_000_0159_01C4A198.2ABFF2A0 Content-Type: application/octet-stream; nameュョ「 テュヤュナコ ュ テュトコ サ ュョ「 ァァ ツ メナミ ス イーーーー ス 「エイ「 ス 「エイ「 ェ アーーーー メリア ス ・ワチワェワ メリイ ス ・ワモ ス ィイーゥ ョ 「 ス 「 メナミョ ・ワチワェワ ス ョ 「 ス 「 メナミョ ・ワチワェワ ス ョ 「 。 「 メナミョ ・ワモ 。 ョ 「 。 「 メナミョ ・ワモ 。 ョ 「メリア ス 「 メナミョ メリア ス ョ 「メリア ス 「 メナミョ メリア ス ョ 「メリイ 。 「 メナミョ メリイ 。 ョ 「メリイ 。 「 メナミョ メリイ 。 ョ 「 ス 「 メナミョ 。 ・ワチワェワ ョ 「 ス 「 メナミョ ス ・ワチワェワ ョ 「 。 「 メナミョ 。 ・ワモ ョ 「 。 「 メナミョ 。 ・ワモ ョ 「 ス メリア「 メナミョ 。 メリア ョ 「 ス メリア「 メナミョ ス メリア ョ 「 。 メリイ「 メナミョ 。 メリイ ョ 「 。 メリイ「 メナミョ 。 メリイ ョ 「ョョソ「 メナミョ ョョソ ョ 「ョョソ「 メナミョ ョョソ ョ ヌテョ ョ ュュュュュ ミ゜ーーー゜ーアオケ゜ーアテエチアケクョイチツニニイチーュュ