You must Sign In to post a response.
  • Category: ASP.NET

    TO Upper & To Lower Case ignore and match with string

    myString = FtpAddressUrl + BranchName + "-ON" + "/" + ftp_Folder;

    if (subdirectoryEntries.Any(myString.ToUpper().Contains) || subdirectoryEntries.Any(myString.ToLower().Contains))
    {
    }

    myString define as a string .
    subdirectoryEntries is a collection of list.
    In subdirectoryEntries it is reterive the folder from the FTP and in myString it is string variable.
    In mystring i am storing FtpAddressUrl ,BranchName ,ftp_Folder and pass ON is static.
    But some cases when i am comparing with the string it i condition fails

    when BranchName is in Capital letter & on is in Small letter. Always it fails according to my if condition, where i am taking lower and upper cases.
    Example: On subdirectoryEntries it is showing this (jaid-ON/)
    jaid it is Branch it is in small letter
    ON it is in Capital Letter

    So i don't have any idea how i can put my condition

    if (subdirectoryEntries.Any(myString.ToUpper().Contains) || subdirectoryEntries.Any(myString.ToLower().Contains))
    {
    }

    According to my condition Branch name it should completely either Capital or Small.
    Means This condition i am managing.
    jaid-on/ (Branch Name + on)
    JAID_ON (Branch Name + ON)
    But I have to manage another condition that string match condition
    jaid-ON/ (Branch Name + ON)
    JAID-on/ (Branch Name + on)

    How i can do it
  • #769016
    Hi,

    I am not clearly understand your requirement. But you are using IF condition for both the lower and upper case if both are present then you are allowing the condition to enter into the IF statement.

    Have you tried like this,


    if (subdirectoryEntries.Any(myString.ToUpper().ToString().Contains) || subdirectoryEntries.Any(myString.ToLower()..ToString().Contains))
    {
    }


    If it is not working. Kindly let us know what is issue you are getting when you try to implement this uppercase in IF condition.

    Thanks,
    Mani


  • Sign In to post your comments