Function to evaluate whether a string is all UPPER

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Function to evaluate whether a string is all UPPER

    I'm trying to clean up strings in a web form before I plug the fields
    into a database. Lots of folks like to leave caps lock key on and
    yell their form entries.

    I can figure out how to change strings to sentence case, but I don't
    want to do it to every string since some correctly entered words e.g.
    "to" would be converted unnecessarily (to "To"). I'm willing to live
    with the over correction on a few strings, but don't want to apply it
    to the entire database.

    Has anyone used a function to evaluate whether a string has been
    entered all in upper case?


    Thanks,

    Brad Smith
    pbs at myrealboxNOSPAM.com
    remove NOSPAM from address and replace at with @ to email me directly
    Brad Smith Guest

  2. Similar Questions and Discussions

    1. evaluate string
      Hi I hve a list mylist= I am inserting the values dynamically in the string format in the list and the list becomes mylist=] or mylist=] now...
    2. problems with evaluate-function and " ' " in query
      hello. strange problem. let's say i have the following variable: cfset content = "let's rock" if i make an insert-query into a ms sql server...
    3. Evaluate variables in midst of a string!
      I need help evaluating variables in the middle of a string. I am querying a table and one of the rows outputs the following code: Hello #username#!...
    4. String formatting function - First char Upper, rest lower
      Hi, Newbie question. Does anyone know of a function or script that will capitalize the first char and lowercase the remaining chars of each...
    5. OCI_ASSOC returns key with upper case string
      Hello, First let me say that I am not sure if this is PHP problem or Oracle. I have a class that contains API for using postgresql, mysql, or...
  3. #2

    Default Re: Function to evaluate whether a string is all UPPER

    Convert the string to all upper case, and compare the result to the original
    string. If they are equal, the original string is all upper case.

    HTH,

    Kevin Spencer
    Microsoft FrontPage MVP
    Internet Developer
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of Little things.

    "Brad Smith" <pbs@mailandnews.com> wrote in message
    news:65529f27.0306270727.2bea89c3@posting.google.c om...
    > I'm trying to clean up strings in a web form before I plug the fields
    > into a database. Lots of folks like to leave caps lock key on and
    > yell their form entries.
    >
    > I can figure out how to change strings to sentence case, but I don't
    > want to do it to every string since some correctly entered words e.g.
    > "to" would be converted unnecessarily (to "To"). I'm willing to live
    > with the over correction on a few strings, but don't want to apply it
    > to the entire database.
    >
    > Has anyone used a function to evaluate whether a string has been
    > entered all in upper case?
    >
    >
    > Thanks,
    >
    > Brad Smith
    > pbs at myrealboxNOSPAM.com
    > remove NOSPAM from address and replace at with @ to email me directly

    Kevin Spencer Guest

  4. #3

    Default RE: Function to evaluate whether a string is all UPPER

    Hi Brad,

    Could you try this:

    string a = "Dodo";
    if (a == a.ToUpper())
    {
    // the string is all in uppercase!
    }

    Thanks,
    Blaise Pascal Tine (MSFT).
    --------------------
    >From: [email]pbs@mailandnews.com[/email] (Brad Smith)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >Subject: Function to evaluate whether a string is all UPPER
    >Date: 27 Jun 2003 08:27:00 -0700
    >Organization: [url]http://groups.google.com/[/url]
    >Lines: 19
    >Message-ID: <65529f27.0306270727.2bea89c3@posting.google.com >
    >NNTP-Posting-Host: 129.111.166.176
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1056727621 21410 127.0.0.1 (27 Jun 2003
    15:27:01 GMT)
    >X-Complaints-To: [email]groups-abuse@google.com[/email]
    >NNTP-Posting-Date: 27 Jun 2003 15:27:01 GMT
    >Path:
    cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
    e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-
    xit-09!supernews.com!postnews1.google.com!not-for-mail
    >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:155460
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >I'm trying to clean up strings in a web form before I plug the fields
    >into a database. Lots of folks like to leave caps lock key on and
    >yell their form entries.
    >
    >I can figure out how to change strings to sentence case, but I don't
    >want to do it to every string since some correctly entered words e.g.
    >"to" would be converted unnecessarily (to "To"). I'm willing to live
    >with the over correction on a few strings, but don't want to apply it
    >to the entire database.
    >
    >Has anyone used a function to evaluate whether a string has been
    >entered all in upper case?
    >
    >
    >Thanks,
    >
    >Brad Smith
    >pbs at myrealboxNOSPAM.com
    >remove NOSPAM from address and replace at with @ to email me directly
    >
    Blaise Pascal Tine Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139