Counting upper case characters

set T_ to "My Grand Question"
set T_cnt to count T_ --> 17
Straightforward way to count the upper case characters of T_? A simple "do shell script" approach would be fine.

set tString to "My Grand Question"
set cString to 0
repeat with i in tString
set aNumber to ASCII number i
if ((aNumber > 64) and (aNumber < 91)) then set cString to cString + 1
end repeat
cString

Similar Messages

  • More on counting upper case characters

    (*This relates to a recent question I posted about counting upper case characters in a string. dev_sleidy responded with an applescript approach that works, but at 6 lines I was hoping for more compact code. So I played around with a one-line command line approach that so far seems reliable (tell me if you find it isn't). However, there are a couple peculiarities which I would like to understand. I know, I know, I should just shut up and use it. But I must be part cat and need to be killed.
    The code that appears to work:*)
    set T to "MY GraNd QuestioN A"
    set UCcount to do shell script "echo " & quoted form of T & " | tr -d [[:space:]] | tr -d [:lower:] | wc -m"
    (*The peculiarities:
    1) If I substitute >>sed 's/ //g'<< for >>tr -d [[:space:]]<<, the result always seems to be one count high. (Same thing appears to happen when executed in Terminal.) Why?
    2) When using regular expressions the format [[:class:]] has always worked for me, as it does for "space" in the code above. But for the second tr -d pipe (above code) those outside brackets mess everything up, and single brackets work fine. Same thing happens with both [[:lower:]] and [[:upper:]] but doesn't seem to happen when executed in Terminal. Why? Are there rules for bracketing character classes (I've seen different versions)?
    Or is all this a UNIX forum question?*)

    Hello
    Honestly I don't understand why such result is returned by CODE1.
    Its prototype [1] tested here works as expected.
    But I noticed CODE2 may return wrong result, for its prototype [2] actually returns wrong result with MacPerl 5.6.1r2 under OS9.1 when input string is read from file insead of being given as string literal. I didn't test that possibility. Sorry for that. Please disregard CODE2, for I think CODE1 will be enough.
    (The wrong result is caused by the fact that 'Ç' encoded in UTF-8 is counted as 2 chararcters by length function if it is read from file due to certain limitation of MacPerl 5.6.1r2. I don't know whether that applies to recent Perl under OSX.)
    [1]
    use utf8;
    while (<>){
    s/[^[:upper:]]//g;
    } continue {
    print;
    [2]
    use utf8;
    local $/;
    while (<>){
    s/[^[:upper:]]//g;
    print length;
    Re. your original question about peculiarities.
    As for 1), I think it is because 'echo' is adding trailing \n and "sed 's/ //g'" won't remove it. Try "sed 's/[[:space:]]//g'"  instead. Indeed "sed 's/[^[:upper:]]//g' will remove all non-upper case letters at once, I guess.
    As for 2), I think it is because 'tr' actually does not process regexp. Its character class support is based upon POSIX but the usage is different from regexp, i.e. [:class:] in 'tr', while [[:class:]] in proper regexp. Meanwhile, I think, the regexp syntax, [[:class:]], in 'tr' argument works in Terminal because in Terminal, 'bash' processes the regexp in its parameter expansion (path name expansion, in this case) and 'tr' receives the expanded result as its argument.
    cf.
    http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/tr.1.htm l
    http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/bash.1.h tml
    Hope this may be of some help,
    H

  • Firefox does not recognize upper case characters on my keyboard, when i try to log in on a saved website with a case-sensitive user/password. repeated Capslock on, then off, or Shift on, then off, sometimes corrects. thx

    this happens almost every time I get onto my computer. doesn't happen when using Explorer

    Greetings NoNameGiven,
    If I understand the problem correctly (I’m not sure I do) you would prefer ‘iii’ to be read as “eye eye eye” rather than “three”? The alt text property is the only way that I know of to make this happen. Hope this helps.
    a ‘C’ student

  • Special characters converted in wrong in Upper case ?

    Hello,
    In material description , some characters such as µ when converted into upper case it will be 'M' in stead of 'µ' . This is in SAP ECC unicode . But it's ok in R/3.
    So in this case, Is there any solution for this problem ?
    Thanks

    MAKT-MAKTG : For upper case characters , When our client search for values when pressing F4 in material , If there's material description that contain 'u03BC', It will be displayed as 'M' in the text . This will happen in ECC 6 not in R/3 ( in R/3 two texts are the same) .
    The different behavior you're observing between what you call R/3 and ECC 6 is not due to the different releases, but based on the fact that one system is Unicode enabled and the other not. I suspect that you are most likely logging onto the system with a language that's linked to code page 1100 (in the non-Unicode release). Code page 1100 is similar to the Latin-1/ISO-8859-1 code page, which is designed to have most characters for western languages, but does not contain all Greek letters (SAP would most likely use code page 1700 if you set a greek locale).
    Again, it may sound silly, but you have to distinguish between the symbol µ (Unicode code point U+00B5) and the lower case greek letter u03BC (U03BC). SAP code page 1100 contains only the symbol µ (U00B5), which represents the prefix micro as for example in 1µm = 1 micro meter = 0.000001m. Neither the greek lower case letter u03BC (U+03BC) nor it's corresponding upper case letter exists in code page 1100.
    The Unicode standard defines the greek upper case letter u039C (U039C) as the upper case to use for both the symbol  µ (U00B5) and the lower case greek letter u03BC (U+03BC), see for example the Unicode mapping chart for Greek (so that's why you see a different behavior in ECC 6).
    I'm not sure why, but for some reason SAP found it worthwhile mentioning that they actually also convert the symbol  µ (U00B5) to u039C (U039C), though that essentially just means following Unicode standard. Anyhow, if you're interested in further details, check out OSS note 1078295 - Incomplete to upper cases in old code pages.

  • Small caps - is there a way to change size ratio of lower to upper case?

    I am using Adobe InDesign CS4 and one problem I've had is that when I select Small Caps on the character styles panel, lower case characters are about 60% the size of upper case characters. I'd like this to be more around 80% in my document.
    I don't see a way to do this, so I'm having to avoid using Small Caps and am having to select various portions of each word and set them to different sizes.
    Is there a setting I am missing for Small Caps that would save me this trouble? My typeface is Minion so I may also see if there's a variant available that uses well-crafted small caps.
    Tim

    Dave,
    >.. adjust the size of the "lowercase" characters by using a GREP style
    Yes ... and no.
    It doesn't have to be an extremely complicated GREP style. You mention Unicode ranges, but it's not even necessary. You could try
    >[a-z]
    to select all lowercase characters, but it leaves out accented ones. Now specifying ranges for these doesn't work very good (to put it mildly), because they do not appear consecutively in the Unicode set.
    Fortunately, GREP has a wildcard
    >\l
    for "lowercase", and this matches
    i every
    lowercase character (even Greek and Russian ones). It's equal to the POSIX expression
    >[[:lower:]]
    As this seems to work just the way you want, then why the "No"? The GREP style will be applied to
    i all
    lowercase characters in the paragraph, not just to the words you wanted.
    [Warning: Dirty trick follows. Do Not Copy Unless Forced To.]
    Of course you can
    i force
    the GREP style pick up 'unique' words by making them unique somehow. If you insert an invisible character
    i before
    and
    i after
    the words you want to mark -- in the case at hand, the ones you want to small-capitalize --, you can include the invisible characters in the GREP style. For example, by specifying
    >~-\l+~-
    you can "mark" words by inserting a soft hyphen before and after certain words. (This example also presumes only lowercase characters inbetween.) You don't have to use the soft hyphen, there are a couple more markers you could (ab)use. I think I'll leave it up to your imagination to wonder where it could possibly go wrong.

  • Issue with upper case in cyrillic characters - error with SID generation

    Hi all,
    I have a problem loading a cyrillic string into a characteristic in a DSO.
    I get an error message when trying to activate the data in the DSO.
    The characteristic is a CHAR18 with the "lowercase letters" unmarked and there is an abap
    routine to convert the string in upper case.
    According to the error message, the string seems to be converted because the error shows the string in upper case ( the input was in lower case)  but the DSO data is not activated:
    " Value 'НЕУСТОЙКА 3498' (hex. '041D0415042304210422041E0419041A041000200033003400')
    of characteristic A2_ALLOCN contains invalid characters",
    I am working in an unicode system and I don´t know what is wrong...
    Any input will be highly appreciate it.
    Thanks in advance,
    Elena

    Value 'НЕУСТОЙКА 3498'
    Seems to be value contains invalid character.  Й
    If you need to populate invalid char into target  maintain this in t- code RSKC , Then system allows the Invalide chars into the target
    Donu2019t need edit this ivalue manually in PSA with required value and reconstruct from PSA.
    With Regards,
    Kishore.
    Edited by: Siv Kishore on Apr 22, 2009 11:37 AM
    Edited by: Siv Kishore on Apr 22, 2009 11:39 AM

  • Upper or Lower Case Characters

    Hi everyone:
    I know this may sound silly, but I am new at this so be nice!
    When creating an address for your webpage, do the charcters
    have to be upper case or lower case. I know that I have seen some
    web addresses with both upper and lower case.

    I think she means domain name. In that case, it doesn't
    matter. There's no
    upper case in domain names.... As far as I know.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Alan" <[email protected]> wrote in
    message
    news:C0B5DC49.292429%[email protected]..
    > do you mean file and folder names?
    >
    > You can use what you want-
    > Something to be aware of, unix/linux servers (which are
    the majority of
    > hosting) are case-sensitive. If you name a file
    BoxTop.HTM and link to it
    > as boxtop.htm the link will not find the file.
    >
    > I would suggest a conservative file and folder naming
    convention to avoid
    > possible problems. Lower-case a-->z and 0-->9
    only. No blank spaces, no
    > punctuation or other things.
    >

  • "why the Psoft oracle DB and SID names should be in all upper case

    Customer is having a Question like
    "why the Psoft oracle DB and SID names should be in all upper case (according to the PsoftTools 8.50 Installation for Oracle manual)
    why the Peopletools 8.5 install book states all Oracle SID and database names should be in UpperCase.
    If we use lower case database name, would encounter any problems, what sort of problems?
    i Observed that all the Installation manual for 8.49,50,51 States the Same for Creating of Data base !
    Task 1-6-1: Determining Databases and Database Names
    You should also determine the names of the
    databases at this point, using database names that:
    • Are limited to eight characters, all UPPERCASE.
    • Capture information about the PeopleSoft product line and the type of database
    Please suggest on this !
    Thanks
    Bala

    user13798675 wrote:
    Customer is having a Question like
    "why the Psoft oracle DB and SID names should be in all upper case (according to the PsoftTools 8.50 Installation for Oracle manual)
    why the Peopletools 8.5 install book states all Oracle SID and database names should be in UpperCase.
    If we use lower case database name, would encounter any problems, what sort of problems?
    i Observed that all the Installation manual for 8.49,50,51 States the Same for Creating of Data base !
    Task 1-6-1: Determining Databases and Database Names
    You should also determine the names of the
    databases at this point, using database names that:
    • Are limited to eight characters, all UPPERCASE.
    • Capture information about the PeopleSoft product line and the type of database
    Please suggest on this !
    Thanks
    Balabcm@bcm-laptop:~$ env | grep ORA
    ORACLE_SID=v112
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
    bcm@bcm-laptop:~$

  • How to convert lower case to upper case?

    Hi,
    How to convert lower case letter to upper case and vice versa?

    TRANSLATE
    Variants:
    1. TRANSLATE c TO UPPER CASE.
    2. TRANSLATE c TO LOWER CASE.
    3. TRANSLATE c USING r.
    See String processing
    Variant 1
    TRANSLATE c TO UPPER CASE.
    Variant 2
    TRANSLATE c TO LOWER CASE.
    Effect
    The first variant converts all lowercase letters in c to uppercase. The second variant converts all uppercase letters to lowercase.
    Example
    DATA letters(3) TYPE C.
    MOVE 'abc' TO letters.
    TRANSLATE letters TO UPPER CASE.
    letters now has the contents 'ABC'.
    Note
    The classification of upper- and lowercase, and the actual characters used are determined by the current text environment (see SET LOCALE LANGUAGE). Problems may occur when the system converts the characters, if the wrong language has been specified in SET LOCALE LANGUAGE, or if data has been processed that does
    Variant 3
    TRANSLATE c USING r.
    Effect
    Replaces all the characters in the field c according to the rule in field r. c1 containscharacter pairs. The second character in each pair replaces the first. If r does not contain a character in c, this character remains unchanged. r can also be a variable.
    Example
    DATA: letters(20) TYPE C VALUE 'abcabcabcXab',
          change(15)  TYPE C VALUE 'aXbaYBabZacZ'.
    TRANSLATE letters USING change.
    letters now contains 'XaZXaZXaZXXaZ'.
    REWARD IF USEFUL

  • Capitalization doesn't work as described. One can start with lower case and change to upper, but changing from upper case to any of the other options doesn't work. Is there a way around this or is this just a glitch that needs fixing?

    In Pages capitalization doesn't work as described. One can start with lower case and change to upper, but changing from upper case to any of the other options doesn't work. Is there a way around this or is this just a glitch that needs fixing?

    I think it does work as described, but the description is not very complete. Capitalization does not change any of the characters that you type; what it does is allow some of the lower case characters to display as capitals. If you copy the result and paste it as plain text, you'll see that the lower case characters are still there. It doesn't actually say anywhere that it can make capitals display as lower case, and it can't.
    The obvious way around this is to actually type what you want.
    The more powerful way is to install WordService from Devon Technologies which adds the functionality of Pages' capitalization menu as well a lot of other ones. WordService actually changes the character to the one displayed, and it works in most of the applications on your Mac.

  • Convert mixed case value in colum into upper case values

    Hi All,
    I have got a table call emp and has the following colums:
    id number 10
    suename_name varchar2(20)
    given_name varchar2(20)
    position varchar2(30)
    date_hired date
    Now the values in colums are mixed case and I need to change them to upper case. I think I need to use upper function to do it.
    Could anyone help me by providing me sql/pl sql script to through each colum in emp table and change them to the upper case.
    Many Thanks
    Michael

    Hi,
    If you really want to try this using PL/SQL, then you'll have to use dynamic SQL, something like this untested code, since the table and column names are vaiable:
    SET   SERVEROUTPUT  ON  SIZE 50000
    DECLARE
         sql_txt     VARCHAR2 (4000);
    BEGIN
         FOR  r  IN ( SELECT  table_name
                   ,       column_name
                   FROM    user_tab_columns
                   WHERE   data_type = 'VARCHAR2'
              --   AND     ...  -- if you don't want all columns in all tables
         LOOP
              sql_txt := 'UPDATE "'
                   || r.table_name
                   || '" SET "'
                   || r.column_name
                   || '" = UPPER ("'
                   || r.column_name
                   || '")';
              dbms_output.put_line (sql_txt || ' = sql_txt');     -- For debugging
              -- EXECUTE IMMEDIATE sql_txt;               -- For real
         END LOOP;
    END;Dynamic SQL (here) means creating a string that contains the SQL statement to be done, then using EXECUTE IMMEDIATE to run it.
    Whenever you write dynamic SQL, it's a good idea to only display the SQL statement during the early stages of debugging. When it's displaying correctly, then you can try un-commenting the EXECUTE IMMEDIATE line.
    Edited by: Frank Kulash on Jul 19, 2009 4:40 PM
    A little more complicated, but a lot more efficient:
    SET   SERVEROUTPUT  ON  SIZE 50000
    DECLARE
         sql_txt          VARCHAR2 (4000);
    BEGIN
         FOR  r  IN ( SELECT    table_name
                   ,         column_name
                   ,         ROW_NUMBER () OVER ( PARTITION BY  table_name
                                      ORDER BY       column_name
                                    )     AS column_num
                   ,            COUNT (1)     OVER ( PARTITION BY  table_name
                                    )     AS total_column_cnt
                   FROM      user_tab_columns
                   WHERE     data_type = 'VARCHAR2'
              --   AND       ...  -- if you don't want all columns in all tables
                   ORDER BY  table_name
                   ,            column_name
         LOOP
              IF  r.column_num = 1
              THEN
                   sql_txt := 'UPDATE "'
                   || r.table_name
                   || '" SET "';
              ELSE
                   sql_txt := sql_txt || ', "';
              END IF;
              sql_txt := sql_txt ||
                   || r.column_name
                   || '" = UPPER ("'
                   || r.column_name
                   || '")';
              IF  r.column_num = r.total_column_cnt
              THEN     -- This is the last row for this table; run it
                   dbms_output.put_line (sql_txt || ' = sql_txt');     -- For debugging
                   -- EXECUTE IMMEDIATE sql_txt;               -- For real
              END IF;
         END LOOP;
    END;
    {code}
    The difference is that the first solution produces and executes a separate UPDATE statement for each column, like this:
    {code}
    UPDATE "TABLE_1" SET "COLUMN_A" = UPPER ("COLUMN_A");
    UPDATE "TABLE_1" SET "COLUMN_B" = UPPER ("COLUMN_B");
    UPDATE "TABLE_1" SET "COLUMN_C" = UPPER ("COLUMN_C");
    {code}
    but it's much more efficient to do change all the columns at once, as long as you have the row in hand.  So the second solution only creates one SQL statement per table, like this:
    {code}
    UPDATE "TABLE_1" SET "COLUMN_A" = UPPER ("COLUMN_A")
               ,   "COLUMN_B" = UPPER ("COLUMN_B")
               ,   "COLUMN_C" = UPPER ("COLUMN_C");
    {code} where every line above corresponds to a row fom the query.  The first line for every table will start with
    {code}
    UPDATE "TABLE_1" SET "but all the others will start with
    {code}
    and only on the last column for a given table will the statement be executed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Special character not being converted to upper case

    Hi all,
    I have an issue with special characters and upper/lower case.
    The character "ü" is in one of the values of an InfoObject and when loading we get an error message for this value. The character "Ü" is in RSKC, but still we are getting an error when loading.
    We are converting the values to upper case in the transfer rules, but this special character is not being converted to upper case...
    We start with the value "Heüringen" and after conversion we have the value "HEüRINGEN" where we want to have "HEÜRINGEN".
    Do you have any idea why this characer is not being converted?
    Any ideas are welcome!
    Best regards,
    TMV

    Hi Praveen,
    What does this module actually do? What kind of characters will the special chars be replaced with?
    Br,
    TMV

  • Calling Function Module for upper case to lower case in Transformation

    Hi all,
    We have the data load happening everyday for the Account Receivables data. The DSO activation is failing because of the invalid characters. It gives the messages as below
    "Value 'bdmg0808dm' (hex. '620064006D006700300038003000380064006D00') of characteristic ZINVNUM contains invalid characters"
    We understood that the character ZINVNUM is maintained only for uppercase letter wherein the lower case check box is not ticked. We have a function module which is build within BI which can be used to permit non permitted characters including space. Just want to know how can I call this function module in a transformation and which is the best option to call the function module(start routine/end routine).
    Regards
    Vijay

    You can use statement in end routine to convert text to upper case. No need of calling any function module. Just loop through records of RESULT_PACKAGE and for that particular field convert text using below statement.
    LOOP AT RESULT_PACKAGE.
    TRANSLATE RESULT_PACAKGE-/BIC/ZNAME TO UPPER CASE.
    ENDLOOP.
    Edited by: ABHIJIT TEMBHEKAR on Nov 14, 2008 2:22 PM

  • PB-backlight in keyboard or upper case?

    Unfortunately, I didn't get too much feedback on my last post ( Florian Duenzen, "PB-keyboard / replacement part numbers", 04:40pm Sep 26, 2005 CDT), so I'll try to make it a bit easier with this one:
    Is the backlight of the recent PowerBook revisions (including the last one) part of the keyboard itself or is it soldered to the upper case? I could not make it out in pbfixit.com's pictures, and my PB is still under Apple Care warranty, so I can't take it apart myself to check it.
    My keyboard is broken and I have to figure out, what service part I can use to replace it. Of course, I would like to go for the brighter backlight from the latest revision, if it is indeed soldered to the keyboard and compatible with my revision (see signature).
    Thanks a lot,
    Florian.

    Don't know if i get you exactly, but if you want to check case-insensitive, you could do:
    SELECT count(*)
    FROM my_database
    WHERE UPPER(user_id) = UPPER(:my_database.user_id);Be aware that any index on user_id will not be used with this approach.

  • How to convert a text file in lower case to upper case?

    I've a beginner in java world and I just come through the tutorial in http://java.sun.com/docs/books/tutorial/essential/io/filestreams.html showing how to copy a text file:
    import java.io.*;
    public class Copy {
    public static void main(String[] args) throws IOException {
         File inputFile = new File("farrago.txt");
         File outputFile = new File("outagain.txt");
    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    int c;
    while ((c = in.read()) != -1)
    out.write(c);
    in.close();
    out.close();
    And I would like to ask how to covert all lower case letters in input file to upper case letter in output file at the same time of copying.
    I guess it'll be using Character.toUpperCase(c), but I don't know how to do it actually.
    Any help would be much appreciated.

    Hope this helps
    import java.io.*;
    public class Copy {
    public static void main(String[] args) throws IOException {
    File inputFile = new File("farrago.txt");
    File outputFile = new File("outagain.txt");
    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    BufferedReader buff = new BufferedReader(in);
    String c;
    while ((c = buff.readLine()) != null)
    out.write(c.toUpperCase());
    in.close();
    out.close();
    }

Maybe you are looking for

  • One of my two processors quits!

    My dual processor (500mhz) gigabit ethernet computer has done this twice now: one of the processors stops working. It doesn't cause any problems besides slowing the machine down. The only reason I notice is that I have Menu Meters installed, and I'll

  • PREVIEW SaveAll and Print All

    I'm having a devil of a time with my Preview scans. 1. Is there a way to SaveAll scans that end up in a Preview Document? I have a bunch of tif's (sometimes these come in as a Document Feeder and sometimes they are a series of hand placed originals.

  • Beginner's question

    i started to work with labview newly, the task im tryin to do is the following : i have a microcontroller and i wanna know if it is alive or not .. simply am tryin to open a port (com) and to ping the microcontroller using the functions (.dll provide

  • Can't import anything into Final Cut 7.0.3

    I just recently updated my OS to Snow Leopard (10.6.7) along with Final Cut Pro 7.0.3. and now for some reason Final Cut does not recognize anything, video, audio, stills, nothing. I've found a workaround for video files, save as itself in Quicktime.

  • New iPhone only plays from one headphone.

    I got my iPhone 5 today and music only plays from the right headphone, no matter what headset I use.  This also happened with my iPhone 4 so I thought the problem would be gone with the new phone. So I am thinking it might be a setting or something,