jefhal Posted October 10, 2005 Posted October 10, 2005 (edited) What is the fastest (least code) method for turning a "raw" mac id into a "formatted" one? i.e. turn 001122334455 into 00-11-22-33-44-55 Edited October 10, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Valuater Posted October 11, 2005 Posted October 11, 2005 how about this Dim $Final = "", $xt = 1 $String = "001122334455" $Result = StringSplit($String, "") For $x = 1 To $Result[0] If $x = $xt + 2 Then $xt = $x $Final = $Final & "-" EndIf $Final = $Final & $Result[$x] Next MsgBox(0,"Final Result", $Final ) 8)
jefhal Posted October 11, 2005 Author Posted October 11, 2005 $Result = StringSplit($String, "") If $x = $xt + 2 Then I like the stringsplit using "empty" and the use of $xt. Thank you! For some reason I thought you could use RegExp or StringFormat, as I really don't understand what those are for... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Valuater Posted October 11, 2005 Posted October 11, 2005 .. I thought you could use RegExp or StringFormat, as I really don't understand what those are for... Me eitherglad i could help8)
sykes Posted October 11, 2005 Posted October 11, 2005 (edited) Heres my contribution: Dim $mac_addy $mac = "112233445566" For $x = 1 To StringLen($mac) Step 2 If $mac_addy = "" Then $mac_addy = StringMid($mac, $x, 2) Else $mac_addy = $mac_addy & "-" & StringMid($mac, $x, 2) EndIf Next Msgbox(0, "", $mac_addy) Edited October 11, 2005 by sykes We have enough youth. How about a fountain of SMART?
Skruge Posted October 11, 2005 Posted October 11, 2005 Here's what I came up with... Dim $strMAC = "001122334455" Dim $strTemp For $x = 0 to (StringLen($strMAC) / 2) - 1 $strTemp = $strTemp & StringMid($strMAC, 1 + ($x * 2), 2) & "-" Next $strMAC = StringLeft($strTemp, StringLen($strTemp) - 1) [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]
jefhal Posted October 11, 2005 Author Posted October 11, 2005 (edited) For $x = 1 To StringLen($mac) Step 2$mac_addy = $mac_addy & "-" & StringMid($mac, $x, 2)Sherman, get me another cigar! What's great about coding is that there are always 5 ways to accomplish the same thing! StringMid and Step 2...(StringLen($strMAC) / 2) - 1StringMid($strMAC, 1 + ($x * 2), 2) & "-"I'm running out of cigars, people! StringLen divided by 2 and $x times 2... who woulda thunk? Another superb offering! Edited October 11, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
bluebearr Posted October 11, 2005 Posted October 11, 2005 How about: $raw = "001122334455" $formatted = StringLeft($raw, 2) for $i = 3 to StringLen($raw) - 1 Step 2 $formatted = $formatted & "-" & StringMid($raw, $i, 2) Next BlueBearrOddly enough, this is what I do for fun.
jefhal Posted October 11, 2005 Author Posted October 11, 2005 $formatted = StringLeft($raw, 2)for $i = 3 to StringLen($raw) - 1 Step 2Wow! Give the loop a headstart by setting $formatted to the first two chars. Sweet. Panatella or Churchill?Here's my own attempt at the cigar!dim $var = "001a2b3c4d5e", $ans = "" for $i = 1 to 11 step 2 $ans = stringleft($ans & StringMid($var,$i,2) & "-",17) Next MsgBox(4096,"answer is: ",$ans)Of course, this was AFTER seeing all of your fine attempts! ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Valuater Posted October 11, 2005 Posted October 11, 2005 The Test... 1 to 21 numbers picked at randomthe scriptexpandcollapse popup#include <File.au3> Dim $Number="", $Load="" For $tetster = 1 to 21 $Number = Random( 1, 9, 1) $Load = $Load & $Number Dim $Final = "", $xt = 1 $String = $Load $Result = StringSplit($String, "") For $x = 1 To $Result[0] If $x = $xt + 2 Then $xt = $x $Final = $Final & "-" EndIf $Final = $Final & $Result[$x] Next _FileWriteLog("C:\test.txt", "Valuater " & $Final ) Next _FileWriteLog("C:\test.txt", "*************************************************************") Dim $Number="", $Load="" For $tetster = 1 to 21 $Number = Random( 1, 9, 1) $Load = $Load & $Number Dim $mac_addy $mac = $Load For $x = 1 To StringLen($mac) Step 2 If $mac_addy = "" Then $mac_addy = StringMid($mac, $x, 2) Else $mac_addy = $mac_addy & "-" & StringMid($mac, $x, 2) EndIf Next ;Msgbox(0, "", $mac_addy) _FileWriteLog("C:\test.txt", "sykes " & $mac_addy ) Next _FileWriteLog("C:\test.txt", "*************************************************************") Dim $Number="", $Load="" For $tetster = 1 to 21 $Number = Random( 1, 9, 1) $Load = $Load & $Number Dim $strMAC = $Load Dim $strTemp For $x = 0 to (StringLen($strMAC) / 2) - 1 $strTemp = $strTemp & StringMid($strMAC, 1 + ($x * 2), 2) & "-" Next $strMAC = StringLeft($strTemp, StringLen($strTemp) - 1) _FileWriteLog("C:\test.txt", "Skrug " & $strMAC ) Next _FileWriteLog("C:\test.txt", "*************************************************************") Dim $Number="", $Load="" For $tetster = 1 to 21 $Number = Random( 1, 9, 1) $Load = $Load & $Number $raw = $Load $formatted = StringLeft($raw, 2) for $i = 3 to StringLen($raw) - 1 Step 2 $formatted = $formatted & "-" & StringMid($raw, $i, 2) Next _FileWriteLog("C:\test.txt", "bluebearr " & $formatted ) Next _FileWriteLog("C:\test.txt", "*************************************************************")and the resultsexpandcollapse popup2005-10-10 18:06:08 : Valuater 7 2005-10-10 18:06:08 : Valuater 71 2005-10-10 18:06:08 : Valuater 71-5 2005-10-10 18:06:08 : Valuater 71-59 2005-10-10 18:06:08 : Valuater 71-59-4 2005-10-10 18:06:08 : Valuater 71-59-43 2005-10-10 18:06:08 : Valuater 71-59-43-6 2005-10-10 18:06:08 : Valuater 71-59-43-69 2005-10-10 18:06:08 : Valuater 71-59-43-69-9 2005-10-10 18:06:08 : Valuater 71-59-43-69-91 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-1 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-9 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-2 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-27 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-27-8 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-27-89 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-27-89-5 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-27-89-52 2005-10-10 18:06:08 : Valuater 71-59-43-69-91-12-99-27-89-52-4 2005-10-10 18:06:08 : ************************************************************* 2005-10-10 18:06:08 : sykes 9 2005-10-10 18:06:08 : sykes 9-92 2005-10-10 18:06:08 : sykes 9-92-92-5 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6-92-56-87-59-52-82-51-65 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6-92-56-87-59-52-82-51-65-92-56-87-59-52-82-51-65-9 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6-92-56-87-59-52-82-51-65-92-56-87-59-52-82-51-65-9-92-56-87-59-52-82-51-65-99 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6-92-56-87-59-52-82-51-65-92-56-87-59-52-82-51-65-9-92-56-87-59-52-82-51-65-99-92-56-87-59-52-82-51-65-99-8 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6-92-56-87-59-52-82-51-65-92-56-87-59-52-82-51-65-9-92-56-87-59-52-82-51-65-99-92-56-87-59-52-82-51-65-99-8-92-56-87-59-52-82-51-65-99-83 2005-10-10 18:06:08 : sykes 9-92-92-5-92-56-92-56-8-92-56-87-92-56-87-5-92-56-87-59-92-56-87-59-5-92-56-87-59-52-92-56-87-59-52-8-92-56-87-59-52-82-92-56-87-59-52-82-5-92-56-87-59-52-82-51-92-56-87-59-52-82-51-6-92-56-87-59-52-82-51-65-92-56-87-59-52-82-51-65-9-92-56-87-59-52-82-51-65-99-92-56-87-59-52-82-51-65-99-8-92-56-87-59-52-82-51-65-99-83-92-56-87-59-52-82-51-65-99-83-6 2005-10-10 18:06:08 : ************************************************************* 2005-10-10 18:06:08 : Skrug 2005-10-10 18:06:08 : Skrug 48 2005-10-10 18:06:08 : Skrug 48-48 2005-10-10 18:06:08 : Skrug 48-48-48-32 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38-48-32-22-27-58-61-38-73 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-41 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-41-48-32-22-27-58-61-38-73-41 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-41-48-32-22-27-58-61-38-73-41-48-32-22-27-58-61-38-73-41-74 2005-10-10 18:06:08 : Skrug 48-48-48-32-48-32-48-32-22-48-32-22-48-32-22-27-48-32-22-27-48-32-22-27-58-48-32-22-27-58-48-32-22-27-58-61-48-32-22-27-58-61-48-32-22-27-58-61-38-48-32-22-27-58-61-38-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-48-32-22-27-58-61-38-73-41-48-32-22-27-58-61-38-73-41-48-32-22-27-58-61-38-73-41-74-48-32-22-27-58-61-38-73-41-74 2005-10-10 18:06:08 : ************************************************************* 2005-10-10 18:06:08 : bluebearr 6 2005-10-10 18:06:08 : bluebearr 69 2005-10-10 18:06:08 : bluebearr 69 2005-10-10 18:06:08 : bluebearr 69-62 2005-10-10 18:06:08 : bluebearr 69-62 2005-10-10 18:06:08 : bluebearr 69-62-95 2005-10-10 18:06:08 : bluebearr 69-62-95 2005-10-10 18:06:08 : bluebearr 69-62-95-66 2005-10-10 18:06:08 : bluebearr 69-62-95-66 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63-58 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63-58 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63-58-74 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63-58-74 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63-58-74-73 2005-10-10 18:06:08 : bluebearr 69-62-95-66-37-21-63-58-74-73 2005-10-10 18:06:08 : *************************************************************and the winner isYAAAAAAAA!!!!!!!!! the hobbyist..... Valuater.. ..... ...... ......
Valik Posted October 11, 2005 Posted October 11, 2005 Nobody could do it without a loop, eh? Local $sOriginal = "112233445566" Local $sFormatted = StringRegExpReplace($sOriginal, "(.{2}){6}", "\1-\2-\3-\4-\5-\6") MsgBox(0, "", $sFormatted)
jefhal Posted October 11, 2005 Author Posted October 11, 2005 (edited) The Test... 1 to 21 numbers picked at randomand the winner isYAAAAAAAA!!!!!!!!! the hobbyist..... Valuater.. ..... ...... ......Valuater- I hate to burst such a BIG bubble, but MAC-ID's always come in six pairs. You do win First Prize for being "First" with a solution! That is often better than "Perfect"!By the way, how did my code fare? Edited October 11, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Confuzzled Posted October 11, 2005 Posted October 11, 2005 Amazing stuff! Simon says: Quick, pick a color from 1 to 10.
jefhal Posted October 11, 2005 Author Posted October 11, 2005 (edited) Nobody could do it without a loop, eh?Local $sOriginal = "112233445566" Local $sFormatted = StringRegExpReplace($sOriginal, "(.{2}){6}", "\1-\2-\3-\4-\5-\6") MsgBox(0, "", $sFormatted)YES! THAT's WHAT I WAS LOOKING FOR! I could feel that RegExp had SOMETHING to do with formatting, but could NOT figure it out from the Vulcan writing in the help file on StringRegExpReplace. (Fine if you're a Vulcan --- or a Valik!) Thanks to everyone for a very entertaining evening and a lot of first class solutions to this infuriatingly simple problem. I really do need it for work... Sleep well! Amazing stuff! Simon says: Quick, pick a color from 1 to 10.jefhal says: "Q" Edited October 11, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Valik Posted October 11, 2005 Posted October 11, 2005 Amazing stuff! Simon says: Quick, pick a color from 1 to 10.While such a comment may suffice to confuse an art student you forget that you are dealing with a bunch of people writing software (more or less). I see nothing wrong with asking to pick a color between two numbers although your choice of numbers relegates to selecting only black.
jefhal Posted October 11, 2005 Author Posted October 11, 2005 The Test... 1 to 21 numbers picked at randomMaybe when we go to MACv6 your solution will be ideal! ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Valuater Posted October 11, 2005 Posted October 11, 2005 (edited) Valuater- I hate to burst such a BIG bubble, but MAC-ID's always come in six pairs. You do win First Prize for being "First" with a solution! That is often better than "Perfect"!By the way, how did my code fare?I did this test thinking in Future value... doesn't matter if its a mac-id or what ever... 8)Because you askedexpandcollapse popup2005-10-10 19:10:41 : jefhal4----------- 2005-10-10 19:10:41 : jefhal47----------- 2005-10-10 19:10:41 : jefhal47-9---------- 2005-10-10 19:10:41 : jefhal47-94---------- 2005-10-10 19:10:41 : jefhal47-94-9--------- 2005-10-10 19:10:41 : jefhal47-94-98--------- 2005-10-10 19:10:41 : jefhal47-94-98-9------- 2005-10-10 19:10:41 : jefhal47-94-98-98------ 2005-10-10 19:10:41 : jefhal47-94-98-98-7---- 2005-10-10 19:10:41 : jefhal47-94-98-98-71--- 2005-10-10 19:10:41 : jefhal47-94-98-98-71-1- 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : jefhal47-94-98-98-71-17 2005-10-10 19:10:41 : ************************************************************* 2005-10-10 21:22:17 : Valik 9 2005-10-10 21:22:17 : Valik 95 2005-10-10 21:22:17 : Valik 959 2005-10-10 21:22:17 : Valik 9593 2005-10-10 21:22:17 : Valik 95935 2005-10-10 21:22:17 : Valik 959354 2005-10-10 21:22:17 : Valik 9593545 2005-10-10 21:22:17 : Valik 95935454 2005-10-10 21:22:17 : Valik 959354546 2005-10-10 21:22:17 : Valik 9593545467 2005-10-10 21:22:17 : Valik 95935454672 2005-10-10 21:22:17 : Valik 95-93-54-54-67-27 2005-10-10 21:22:17 : Valik 95-93-54-54-67-274 2005-10-10 21:22:17 : Valik 95-93-54-54-67-2741 2005-10-10 21:22:17 : Valik 95-93-54-54-67-27417 2005-10-10 21:22:17 : Valik 95-93-54-54-67-274179 2005-10-10 21:22:17 : Valik 95-93-54-54-67-2741797 2005-10-10 21:22:17 : Valik 95-93-54-54-67-27417979 2005-10-10 21:22:17 : Valik 95-93-54-54-67-274179798 2005-10-10 21:22:17 : Valik 95-93-54-54-67-2741797983 2005-10-10 21:22:17 : Valik 95-93-54-54-67-27417979839 2005-10-10 21:22:17 : *************************************************************EDITforgot to reset the variables for Valik... now corrected8) Edited October 11, 2005 by Valuater
jefhal Posted October 11, 2005 Author Posted October 11, 2005 I did this test thinking in Future value... doesn't matter if its a mac-id or what ever... 8)Valuater- Thanks for plotting my solution! You're right about the General solution being better than just a specific solution (didn't it take Einstein longer to create the General Theory of Relativity?) Of course, the next problem that came into mind was formatting a phone number! I'm going to look at RegExp's to see if I can extend Valik's ideas to a 3-3-4 format. Time to get out the Vulcan Dictionary! ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
jefhal Posted October 11, 2005 Author Posted October 11, 2005 Here's the code (thanks to Valik) for formatting a phone number! Local $sOriginal = "1234567890" Local $sFormatted = StringRegExpReplace($sOriginal, "(.{3}){2}(....{1})", "\1-\2-\3") MsgBox(0, "", $sFormatted) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
jefhal Posted October 11, 2005 Author Posted October 11, 2005 Simon says: Quick, pick a color from 1 to 10.Is this the scale from which we are choosing:1 Microwave2 Infrared3 Red4 Orange5 Yellow6 Green7 Blue8 Violet9 Ultraviolet10 XrayDo the colors have to come from the Human "visible spectrum", or some other sample population? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now