Example: John

Listed:
John
john
JOhn
jOhn
JoHN
JoHn
johN
jOhN


How can i list like that all probability ?

Recommended Answers

All 11 Replies

Add to listbox and sort it. Listbox1.Sorted = true

no no;
i write 'Joi' to textbox
and he will listed all probability ( like jOi, Joİ, JOi, Joi )
u understand?

no no;
i write 'Joi' to textbox
and he will listed all probability ( like jOi, Joİ, JOi, Joi )
u understand?

Can you explain why do do want to generate thius list, so that there may be any other way to solve the problem.

Just i need that list; how can i ?

How many names do you expect to see in the list -- 1 or 8?

Looks like just the spot for a bit of recursion. create yourself a subroutine that creates the upper and lower case version of an ordinal position and then have it call itself until you reach the end of the string.

I literally just a few different ways, as a case can be written I want to be listed

You want a method to automatically write the word in every manner possible with upper and lower-case letters?

You want a method to automatically write the word in every manner possible with upper and lower-case letters?

Absolutely

Have you thought about the string case as a representation of binary?
You can calculate the number of iterations as the length of the string squared.
So, if there are 4 characters in the name, you would need 16 binary numbers:
0000 to 1111: where 0 represents one case and 1 represents the other.
As the bits get set, they can be used to toggle the case of the characters in the string.

Imports System
Imports System.Linq
Imports System.Text
Module Module1
   Function StringToBinaryCase(ByVal strName As String, ByVal strBinary As String) As String
      Dim sb As New StringBuilder
      For i As Integer = 0 To strName.Length - 1
         If (strBinary(i).ToString().Equals("1")) Then
            sb.Append(strName(i).ToString().ToUpper())
         Else
            sb.Append(strName(i).ToString().ToLower())
         End If
      Next
      Return sb.ToString()
   End Function

   Sub Main()
      Dim strName As String = "John"
      Dim intOrigLen As Integer = strName.Length
      '
      For i As Integer = 0 To (intOrigLen * intOrigLen) - 1
         Console.WriteLine("{0}",
            StringToBinaryCase(strName, Convert.ToString(i, 2).PadLeft(intOrigLen, "0")))
      Next
   End Sub
End Module

Thank you so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.