Skip to main content
Replace("Select","Application.Match").append(explanation)
Source Link

VBA (Excel), with an amazing 322322 244 bytes

Yeah, and I LOVE hexadecimal. (There's no sarcasm font yet, so I'm using italics for now) I'll add comments if someone wantsI'll add comments if someone wants, but I think it's self explanatory. Golfing happened.

Sub b(s)
For Each c In Split(Replace(s,"D",""),"B")
c=Application.Match(c,Array("I","A","O","U","II","IA","IO","IU","AI","AA","AO","AU","IO","OA","OO","OU"),0)
If Not IsError(c)Then d=d &c-1:If Len(d)=2Then e=e &Chr("&h"&d):d=""
Next
Debug.?e
End Sub

With Comments:

Sub b(s)
  'For each string between B's (Remove the D's first)
  For Each c In Split(Replace(s,"D",""),"B")
    'Get the index of the element in the array (Can cause error if empty)
    c = Application.Match (c,Array("I","A","O","U","II","IA","IO","IU","AI","AA","AO","AU","IO","OA","OO","OU"),0)
    'If c isn't an error
    If Not IsError(c) Then
      'Subtract 1 from c and add to d  --> Array index is 1 based
      d = d & (c-1)
      'If d is 2 characters
      If Len(d)=2 Then
        'Add the char from the hex value of d   --> &h forces Hex
        e = e & Chr("&h" & d)
        'Reset d
        d = ""
      End if
    End if
  Next
  'Print the output
  Debug.Print e
End Sub

I really tried to get this into the VB Immediate Window, but it doesn't seem to work there... that would cut 11 characters I think it's self explanatory. I also wanted to put the Match statement into brackets, but that causes a silent error everytime. Help is appreciated :D

Sub b(s)
For Each c In Split(Replace(s,"D",""),"B")
Select Case c
Case"I"
c=0
Case"A"
c=1
Case"O"
c=2
Case"U"
c=3
Case"II"
c=4
Case"IA"
c=5
Case"IO"
c=6
Case"IU"
c=7
Case"AI"
c=8
Case"AA"
c=9
Case"AO"
c="a"
Case"AU"
c="b"
Case"OI"
c="c"
Case"OA"
c="d"
Case"OO"
c="e"
Case"OU"
c="f"
End Select
d=d &c
If Len(d)=2Then
E=E &Chr("&h"&d)
d=""
EndIf
Next
Debug.?E
End Sub

VBA (Excel), with an amazing 322 bytes

Yeah, and I LOVE hexadecimal. (There's no sarcasm font yet, so I'm using italics for now) I'll add comments if someone wants, but I think it's self explanatory.

Sub b(s)
For Each c In Split(Replace(s,"D",""),"B")
Select Case c
Case"I"
c=0
Case"A"
c=1
Case"O"
c=2
Case"U"
c=3
Case"II"
c=4
Case"IA"
c=5
Case"IO"
c=6
Case"IU"
c=7
Case"AI"
c=8
Case"AA"
c=9
Case"AO"
c="a"
Case"AU"
c="b"
Case"OI"
c="c"
Case"OA"
c="d"
Case"OO"
c="e"
Case"OU"
c="f"
End Select
d=d &c
If Len(d)=2Then
E=E &Chr("&h"&d)
d=""
EndIf
Next
Debug.?E
End Sub

VBA (Excel), with an amazing 322 244 bytes

Yeah, and I LOVE hexadecimal. (There's no sarcasm font yet, so I'm using italics for now) I'll add comments if someone wants, but I think it's self explanatory. Golfing happened.

Sub b(s)
For Each c In Split(Replace(s,"D",""),"B")
c=Application.Match(c,Array("I","A","O","U","II","IA","IO","IU","AI","AA","AO","AU","IO","OA","OO","OU"),0)
If Not IsError(c)Then d=d &c-1:If Len(d)=2Then e=e &Chr("&h"&d):d=""
Next
Debug.?e
End Sub

With Comments:

Sub b(s)
  'For each string between B's (Remove the D's first)
  For Each c In Split(Replace(s,"D",""),"B")
    'Get the index of the element in the array (Can cause error if empty)
    c = Application.Match (c,Array("I","A","O","U","II","IA","IO","IU","AI","AA","AO","AU","IO","OA","OO","OU"),0)
    'If c isn't an error
    If Not IsError(c) Then
      'Subtract 1 from c and add to d  --> Array index is 1 based
      d = d & (c-1)
      'If d is 2 characters
      If Len(d)=2 Then
        'Add the char from the hex value of d   --> &h forces Hex
        e = e & Chr("&h" & d)
        'Reset d
        d = ""
      End if
    End if
  Next
  'Print the output
  Debug.Print e
End Sub

I really tried to get this into the VB Immediate Window, but it doesn't seem to work there... that would cut 11 characters I think. I also wanted to put the Match statement into brackets, but that causes a silent error everytime. Help is appreciated :D

Source Link

VBA (Excel), with an amazing 322 bytes

Yeah, and I LOVE hexadecimal. (There's no sarcasm font yet, so I'm using italics for now) I'll add comments if someone wants, but I think it's self explanatory.

Sub b(s)
For Each c In Split(Replace(s,"D",""),"B")
Select Case c
Case"I"
c=0
Case"A"
c=1
Case"O"
c=2
Case"U"
c=3
Case"II"
c=4
Case"IA"
c=5
Case"IO"
c=6
Case"IU"
c=7
Case"AI"
c=8
Case"AA"
c=9
Case"AO"
c="a"
Case"AU"
c="b"
Case"OI"
c="c"
Case"OA"
c="d"
Case"OO"
c="e"
Case"OU"
c="f"
End Select
d=d &c
If Len(d)=2Then
E=E &Chr("&h"&d)
d=""
EndIf
Next
Debug.?E
End Sub