Module Module1


    Sub Main()
        Dim a, b As String
        Console.WriteLine("請輸入三位元字串") : a = Console.ReadLine()

        Console.WriteLine("請輸入任一長字串") : b = Console.ReadLine()

        If b Like "*" & a.Chars(0) & "*" = True And b Like "*" & a.Chars(1) & "*" = True And b Like "*" & a.Chars(2) & "*" = True Then
            Console.WriteLine("三位元字串共有3個包含在長字串中")
        ElseIf b Like "*" & a.Chars(0) & "*" = True And b Like "*" & a.Chars(1) & "*" = True Then
            Console.WriteLine("三位元字串共有2個包含在長字串中")
        ElseIf b Like "*" & a.Chars(0) & "*" = True And b Like "*" & a.Chars(2) & "*" = True Then
            Console.WriteLine("三位元字串共有2個包含在長字串中")
        ElseIf b Like "*" & a.Chars(1) & "*" = True And b Like "*" & a.Chars(2) & "*" = True Then
            Console.WriteLine("三位元字串共有2個包含在長字串中")
        ElseIf b Like "*" & a.Chars(0) & "*" = True Then
            Console.WriteLine("三位元字串共有1個包含在長字串中")
        ElseIf b Like "*" & a.Chars(1) & "*" = True Then
            Console.WriteLine("三位元字串共有1個包含在長字串中")
        ElseIf b Like "*" & a.Chars(2) & "*" = True Then
            Console.WriteLine("三位元字串共有1個包含在長字串中")
        Else
            Console.WriteLine("三位元字串共有0個包含在長字串中")
        End If

        Console.ReadLine()

    End Sub
End Module

 


arrow
arrow
    全站熱搜

    aa 發表在 痞客邦 留言(1) 人氣()