-1

I currently have the following code which transforms the first letter of the surname to uppercase;

static string UppercaseFirst(string s)
{
    if (string.IsNullOrEmpty(s))
    {
        return string.Empty;
    }
    char[] a = s.ToCharArray();
    a[0] = char.ToUpper(a[0]);
    return new string(a);
}

I now want to edit it so it changes all the letters in the surname to uppercase. Should be a simple one but my ascx.cs knowledge is dire! :) thanks

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291

2 Answers2

5

Try return s.ToUpper(); or a variant of, ToUpperInvariant(), etc.

There are a number of ways to do this to be 'culturally safe', depending on your requirements.

Grant Thomas
  • 44,454
  • 10
  • 85
  • 129
1

try this

static string UppercaseFirst(string s)
{
    return s.ToUpper();
}
Ravinder Gujiri
  • 1,494
  • 10
  • 14