Re: Best guess at expressing a string as a variable
Re: Best guess at expressing a string as a variable
- Subject: Re: Best guess at expressing a string as a variable
- From: "email@hidden" <email@hidden>
- Date: Wed, 23 Jan 2013 11:52:03 +0000
On 23 Jan 2013, at 11:40, Jean Suisse <email@hidden> wrote:
> On 23 janv. 2013, at 02:18, "email@hidden" <email@hidden> wrote:
>
>>>>
>>>> My current thinking is, regardless of the language, is to exclude all characters that are not members of NSCharacterSet + (id)letterCharacterSet.
>>>>
>>>> Is + (id)letterCharacterSet the best choice here?
>>>
>>> I don't know. Does it include characters in "すごくやる気がある" ?
>> That is the question. I don't know what range of character ranges + letterCharacterSet includes.
>> A better question might be what is the intended use of + letterCharacterSet. Is it locale dependent?
>>
> That's a fair question. As Jens Alfke pointed out yesterday, the doc states:
>
> Return value: A character set containing the characters in the categories Letters and Marks.
> Discussion : Informally, this set is the set of all characters used as letters of alphabets and ideographs.
> So, it should not depend on the locale. It is however a huge set ! And I guess that you may not want most of it (all chinese ideograms for instance)
My naive thought was that I could use this admittedly huge character set. Bad idea.
>
>>
>> Hmm. Maybe not. I want to keep the generated variable name legible.
>
>> I think I will have to introduce an intermediate NSTextView that filters and displays the natural language input.
>> The user can then modify the variable name if necessary before it gets utilised further.
>
> Maybe you could drop the extra textfields and the processing by requesting the variable name to use an english alphanumeric character set ?
> Otherwise, how would you deal with this input for a variable name: 名前 ? [ If I am a japanese user, I would expect your software to call the variable "namae" ].
I think that if the user enters the like of 名前 as a parameter title I will filter its decomposed version using the alphanumeric character set.
This will give an empty string which I will then default to something sensible.
Basically an alphanumeric approach will be, by definition, very tough on non alphabetic input.
A Japanese speaker using the app to generate scripts will know how to program, hence entering some alpha numerics should be trivial.
A Japanese speaker using the app just to execute the script will see the 名前 parameter title only.
Thanks for the suggestions.
Jonathan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden