Solved

Convert the current item of array to lower

Posted on 2014-03-17
5
200 Views
Last Modified: 2014-03-17
Hi  there,

I am iterating over the array and my requirement is that i convert the current item of an array to lowercase but it seems that there is not method available. Can you please help, i want some thing like this

for (short i = 0; i <= objValues.Length - 1; i++)
                {
 if(objValues[i].GetType() == typeof(string))
                    {
                        if (objValues[i].ToLower() == (SQL_GETDATE).ToLower())
                        {
                            stbColumns.Append("@" + arrStrColumnsValues(i)+ ",");
                            cmSql.Parameters.AddWithValue(arrStrColumnsValues[i], objValues(i));
                        }
                    }
}

Open in new window


sorry i had to replace the brackets with () here otherwise it was not letting me submit the question
regards,
0
Comment
Question by:shah36
  • 2
5 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
Comment Utility
Modify the if statement as follows.
 
if (((string)objValues(i)).ToLower() == (SQL_GETDATE).ToLower())
0
 
LVL 19

Expert Comment

by:Daniel Van Der Werken
Comment Utility
Since we know it's a string already, won't this work?

objValues[i].ToString().ToLower()

Open in new window


But really, this is the wrong way to do a string compare:

string.Equals(objValues[i].ToString(), SQL_GETDATE, InvariantCulture.IgnoreCase)

Open in new window


That's the way I would do a string compare.
0
 

Author Closing Comment

by:shah36
Comment Utility
Ah thanks a lot it works like a charm
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Not a problem, glad to help.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now