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

[REBOL] Interleaving strings -How?

From: webdev:accglobal at: 21-Sep-2000 23:30

This is a multi-part message in MIME format. ------=_NextPart_000_0009_01C02423.F20764C0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Dear "Fellow Rebol Rousers", After having read the docs I have not quite figured out how to accomplish the interleaving of strings. The short and the long of what I want to do is take latitude and longitude coordinate pairs and interleave them with each other. The rational behind this is to place objects that are physically close to each other in the real world close together in computer memory, which we all know is linear and not spherical like the earth. The coordinates are in decimal degrees for the sake of easy manipulation. The max longitude is 180 degrees while the max latitude is 90. Ignore the issue of positive/negative values as indications of north/south east/west locations. The first segment of the numbers would be interleaved on the basis of the non decimal portion of their values (1st three positions assuming required zero padding). The balance of the values would be interleaved on each subsequent pair. As an example: latitude value : 043.6732452849 longitude value: 142.8321724625 interleaved value: 043142 6783 3221 4572 2846 4925 (spaces are only for readability/illustration) The non decimal portion must be padded with a zero for all latitude values (they never exceed 90). For longitude the non decimal portion must be padded with zero if the value is <100. I understand that I must convert the numbers to rebol strings to access the necessary functionality required to step through the "number" and pluck out the required portion. My problem: At bare minimum I need to understand the command syntax for stepping and clipping the string at specific points as well as the method for specifying the length of the clipped portion. Any inspiration would be most appreciated. Thanks in advance, [webdev--accglobal--net] ------=_NextPart_000_0009_01C02423.F20764C0 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=windows-1252" http-equiv=Content-Type> <META content="MSHTML 5.00.2314.1000" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Dear "Fellow Rebol Rousers",</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>After having read the docs I have not quite figured out how to accomplish the interleaving of strings.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>The short and the long of what I want to do is take latitude and longitude coordinate pairs and interleave them with each other.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>The rational behind this is to place objects that are physically close to each other in the real world close together in computer memory, which we all know is linear and not spherical like the earth. </FONT><FONT face=Arial size=2>The coordinates are in decimal degrees for the sake of easy manipulation.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>The max longitude is 180 degrees while the max latitude is 90.<BR>Ignore the issue of positive/negative values as indications of north/south east/west locations.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>The first segment of the numbers would be interleaved on the basis of the non decimal portion of their values (1st three positions assuming required zero padding).<BR>The balance of the values would be interleaved on each subsequent pair.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>As an example:</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>latitude value :&nbsp;&nbsp; 043.6732452849<BR>longitude value:&nbsp;&nbsp; 142.8321724625</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>interleaved value: 043142 6783 3221 4572 2846 4925<BR>(spaces are only for readability/illustration)</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>The non decimal portion must be padded with a zero for all latitude values (they never exceed 90).<BR>For longitude the non decimal portion must be padded with zero if the value is <100.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>I understand that I must convert the numbers to rebol strings to access the necessary functionality required to step through the number and pluck out the required portion.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>My problem:</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>At bare minimum I need to understand the command syntax for stepping and clipping the string at specific points as well as the method for specifying the length of the clipped portion.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2><BR>Any inspiration would be most appreciated.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>Thanks in advance,</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2><A href="mailto:[webdev--accglobal--net]">[webdev--accglobal--net]</A></FONT></DIV
></BODY></HTML>
------=_NextPart_000_0009_01C02423.F20764C0--