• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Character value of 'Enter' and 'Return' Key ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Character value of 'Enter' and 'Return' Key ?


  • Subject: Re: Character value of 'Enter' and 'Return' Key ?
  • From: Steve Christensen <email@hidden>
  • Date: Tue, 28 Mar 2006 16:01:07 -0800

On Mar 28, 2006, at 10:44 AM, Clark Cox wrote:
On 3/28/06, Steve Christensen <email@hidden> wrote:
On Mar 27, 2006, at 9:16 PM, Vaibhav Machhar wrote:

Im using one function [(NSString*) str characterAtIndex:(some
index)] . I
have a text view where I can enter space,enter and return
characters. I
wanted to know the value of 'Enter' and 'Return' key.

 Sample code that Im using is --

  int i ,index = 0,len = [str length];
    for(i=0; i<len; i++)
    {
        if( [str characterAtIndex:i] == 32) // this 32 = for Space.
            index++;
        else
            break;
    }

Well, the Carbon header file Events.h lists the following:

/* MacRoman character codes*/
enum {
   kEnterCharCode                = 3,
   kReturnCharCode               = 13,
   kSpaceCharCode                = 32,
};

The return and space characters have had those values for decades
now, so the only one you'd need to confirm is the enter key. I
haven't tried it with Unicode as yet.

Just an FYI: Where they overlap, Unicode, ASCII are *identical*. So, any Unicode code point that is less than 128 represents the same character as the same ASCII value would.

I realize that but I couldn't remember if the enter key is a standard ASCII character or one added to MacRoman. After all, ASCII 3 is control-C, no? Thus the caveat.


steve


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Character value of 'Enter' and 'Return' Key ? (From: "Vaibhav Machhar" <email@hidden>)
 >Re: Character value of 'Enter' and 'Return' Key ? (From: Steve Christensen <email@hidden>)
 >Re: Character value of 'Enter' and 'Return' Key ? (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: NSWorkspace launchedApplications
  • Next by Date: Hiding zoom & minimize buttons
  • Previous by thread: Re: Character value of 'Enter' and 'Return' Key ?
  • Next by thread: Re: Character value of 'Enter' and 'Return' Key ?
  • Index(es):
    • Date
    • Thread