Solved

Convert the current item of array to lower

Posted on 2014-03-17
5
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 63

Accepted Solution

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

Expert Comment

by:Daniel Van Der Werken
ID: 39934820
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
ID: 39934910
Ah thanks a lot it works like a charm
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39934946
Not a problem, glad to help.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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