Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cica!iuvax!purdue!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Re: Script Manager compatible atof()? Message-ID: <14940@dartvax.Dartmouth.EDU> Date: 9 Aug 89 23:04:59 GMT References: <14919@dartvax.Dartmouth.EDU> <7304@microsoft.UUCP> Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Thayer School of Engineering Lines: 33 In article <7304@microsoft.UUCP> ericsc@microsoft.UUCP (Eric Schlegel) writes: >In article <14919@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: >> My requirements are simple: convert an editText item, input in >>any font or script, to floating point extended or double using the new >>Script Manager for full generality. > >Use the SANE routine Str2Num, which takes a string and returns an >extended. According to IM V-302 (the docs for version 1 Script Man): > > Applications that want to check ASCII strings to see if they > are valid numeric fields, or convert ASCII strings to their > equivalent numeric values, should use the SANE routines to > do so. These routines will always return the correct result, > regardless of the script in which the number is written. According to the version 2 Script Manager manual, this is not enough. It mentions such things as alternate numeric character sets that would have to be filtered to ASCII before SANE would accept them. It also says that the new number routines (Script Manager version 2) provide a means to read both formatted and simple numbers in any script. I've been through this document a couple times, and it is not obvious how one would go about reading a simple number, given that the number could be in any script and would not necessarily contain ASCII digits. There is also an example illustrating the tokenizer in the new Script Manager, and showing what appear to be Japanese characters being expanded to a string containing ASCII digits. So, the original question still stands: How to read an arbitrary number entered by the user in his local script using the latest Script Manager for fullest generality? Earle R. Horton