Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'https://rosettacode.org/wiki/Comma_quibbling
- Imports System
- Module Program
- Sub Main()
- Dim sInput As String() = {"", "ABC", "ABC DEF", "ABC DEF G H"}
- Dim sTemp As String
- For Each sTemp In sInput
- Console.Write(sTemp & " = ")
- sTemp = Replace(sTemp, " ", ",")
- If InStrRev(sTemp, ",") > 0 Then
- sTemp = Mid(sTemp, 1, InStrRev(sTemp, ",") - 1) & " and " & Mid(sTemp, InStrRev(sTemp, ",") + 1)
- End If
- sTemp = "{" & sTemp & "}"
- Console.WriteLine(sTemp)
- Next
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement