Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: newlines

From: brett:codeconscious at: 9-Nov-2001 0:08

> I offer another one: > > method3: [any [thru ".." t: any #"." u: (remove/part t u) :t] to end] > parse/all s method3
It funny, I've got another two as well built around parse. Problem is they fail with exactly the same wrong result (as far as I can tell) as your proposal above. Note that they usually work but on some strings they dont. I have included a compressed version of one such string. Try running the code below. I sincerely hope it comes through the mail properly. For comparison I add my own two new functions at the bottom. I'm at a loss to understand where the problem is. BTW, I've just seen Joel's message re Ladislav's code [ Joel, substitute every s with a p and put a p: s at the start like your code examples. ] Back to my stuff... test-string2: decompress #{ 789C9D590196A53008BB91E7CBF1F7BDD9B10D90008E6FF7AB2D054A93589DE7 C1730E7DF97317EF43D7FF9FF32FF4148F2826DE6B6C81B3B04E4E7F1E8ADBD5 0FCF43717E7C0B574438D41E4E4FE98228621DBD984A88A33BAF495D241E7EAE 81DC7FFCA14D3B86FE7574FCBEE674860A13FC3421E8AAABC213C280272BEC71 52F5CE72F473BAFFC35CC1FDF152C5F17346C5C34413E9A50D7C7FBFFB8E55AD 143599984897288940383F4AA14400D286480A615A32EA21DA88A81A27A065A0 90C82A6A25E4944E53623A0D2D24F7CA09CD1BB219EF5552992B6C245EDD4BD0 183CC1435DE8E8E3E247E6AE214A2002A765207ED6C34600A5F1CE27CBAD3E62 E84A855085962CD673A084A3B4118CABA74ABD14DD3A6FCE06077B78E7E73816 D6BF13A0FAD05E24724C795916552F89487DC2AA3041383428BAC8DA44F8B8A9 6E0055469799E4125E5DB9039C339AE8B452E1422D9DB656DA731F4431454B8A 1D9B97FC5431B5FEBA315FB3201A4B03AA93A6E14FECD09E56044FDA35CE79FE 7AE5D349202E2D806860C320F4A3075F1C2789AB6EFA09BAEC6CED173EB38F8D C0398F2A3F5FCBC119F5D7ED19D5D4D716A6FDD3516A8B3B4F0F6AB3227D69C4 7D2565CD473D00488356D2F7E5B0833A0541F9550EF1A095212B20B9D9789924 0E2744C58EC0DB06E96DF7626D2AACFE8663F3FE6A39C22C8A4F1347B052F3AF F7B11508D0D689CA39451BC1DC64E5B707D86D637C505DAADA1A40A5063BD197 88A850955FB7E8322542AF4E13624A37F79B6DC1CA675BFA855B9A973483BE55 712A2B2654ACF4FFCF07BDAD0C3A377E6D494D609568D529F2F22DB6910699CC DDF46972A85BDC71B115D73FC295DD0A1B29E8A213A60AEFBC3EE90369FB48B5 A45978061FFF0B32116ABF20302D2F2BB3CEA35947113A710BD4523E0B735053 87EE3E6DD5A41D9272797F0944F101929DF057A83EE7616D085117E1EDE89214 6A01F4E0AF2819E23E94AF25A0790534BEDD527A082EE674EB63E16A25CE113E 112882E142C7EAC5C0D9C45199132F7F86AB8CE902D5220CB02E6BD27D0A3ED6 B40D8F46FA6966101D3D6CF8F784729A4C3B80BECAE5CACBE91E1ED3F97FA3FC BB69713B534436747F1693294D1106ABCACAE605CFADC868C491129824271AED 946B97454B6B1ED35B4730FB353325F92EBC52C93715976DE7D35A284D54538D 6E8597D21B18D7E461A76D24A09155BB16D97A87F5DBAB15F851E5CB9BD1E165 93EB332D969DB79D9B8BDF15E3AC873042DC7AB77A7246127DE447D9029E1632 CD5CBDD2E026321BC786B53EDF82E44FC8394B81F8A61AC553FDC3D74E3E92AF E45419559A484CE8919C4F56811A3F3AB390EDCB9FBDDB067B647C8A96A36BD5 764A6C08BDB7A4B3913293B674472B64FBC959706DC4C82DC10452AF2853717E FBFF017F5639C710270000 } LAD3: function [s][t u method3][ method3: [any [thru ".." t: any #"." u: (remove/part t u) :t] to end] parse/all s method3 RETURN s ] r: lad3 test-string2 if find r "..." [print "Oops. Problem."] BDH3: function [s][p a b][ p: s while [probe index? p parse/all p [ to "..." 2 skip a: some #"." b: (remove/part a b) to end]][ p: a ] RETURN s ] BDH4: function [s][p a b][ parse/all s [ any [to "..." 2 skip a: some #"." b: (remove/part a b) :a] ] RETURN s ]