From: dave Date: 2005-08-07T18:26:41+09:00 Subject: Re: Unpack binary files. --nextPart1421223.oZN6hic0xX Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > tar =3D "i6\253m\251e" =A0 =A0# in: =A0binary content > b64 =3D [tar].pack('m') =A0 # out: Base64 encoded string > p b64 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #-> "aTarball\n" excellent! > If you split on /\n/, the newline will disappear so it's > not now available to gsub. I dont split on "\n". I need to center the license text in a TextEdit Window, this widget is 55 char large. I split the file in lines of 55 char: x =3D 0 y =3D 54 lines =3D [] loop { i =3D f[x..y] break if i.nil?() lines.push(("# " + i)) x +=3D 55 y +=3D 55 } lines.each{|i| puts i } The problem 1 (tab related) is in centred input: in: [ tab space ] Gnu Gpl [ tab space ]| <- 70 char | out: [ tab space ] Gnu Gpl [ tab ]| <- 55 char So the output text is right aligned. How can i center the text in a 55 char space? The problem 2 (\n related) is in carriage return: in: bla bla bla ...................................bl a out: bla bla bla ... bl a Should i delete all "\n" that not follow a '.'? =2D-=20 >here are more things in heaven and earth, horatio, than are dreamt of in your philosophy. --nextPart1421223.oZN6hic0xX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iQIVAwUAQvXTy6Ng16HTgg0AAQLoFhAAnepU9BE06gkR2l8C27hq9UVtLwa77zaf XGFUXaviT63nkfqZ5MY4kbCGwwZtEF2DJ+ljbIYBjQNM72LuLBdstthc3X6YLAo0 aelHz0ayTbu+OOhebXVbAVK2r+S6NI/mZFlH5INqFj4m5a2QtDZtrQyQP6cpxoe4 OTUlyDgMsjhoJrKrayLaHj8asaZ6JxzJb1yThIoscQWXleLUCLp0RsF3YsmfHCD1 UNSLTRPazYvpBLwqMyWBFGL1mjMxWBY+8eweM7vLzAXeUu1S0urnJ/8Yc6A+esfV e6BIvLWRnyVyB4/tMzdQciEMoktCr54Da6nYl6vmQ06ZZvBCTS35W2Bky4yWyOa7 ZqpviGJFuE6ChrPvcHMMGnQSwvm47orngP20NyrcOtMIuGcsP52A7tPtQ78wfLm/ F97SfGMia99Hk8JPHZzdsAD2Xznkr7I9ulz+rf854YwU+973exAVdE3D1rzuDw4k 02+C6lBJ6rvgale1W3cxWXIwt/eSmTDPThsZ7qzo4SYPSZTrqtEAz8stqsy4Qser 9BnDGvNiigCgH0zDASxZ4aejKAkKxo98l/AtFIJQ4SNAhM2yndJc2VTIyUVcugGq VF1ScW3XdJ9hl/SL1XAj6KGk4v6MwVTlq0+/tQDKon6nScQbflcKlGFR976FiPUb z+MPrSQ1H5k= =ZaXv -----END PGP SIGNATURE----- --nextPart1421223.oZN6hic0xX--