"- decimal separator (normally '.' but sometimes ',')"
t1=: 0 : 0
1,2,3,-4,5,6.7,8,9,0
2, _999.1,2
)
_12345 ". ];._2 t1
_12345 _12345
_12345 _999.12
t1=: 0 : 0
1,2,3,4,5,6.7,8,9,0
2,999.1,2
)
_12345 ". ];._2 t1
123457 2999.12
"- thousands separator (normally ',' but sometines '.')"
NB. Here it is treating , as if it did not exist
1,2,3,4,5,6,7,8,9,0 is treated as if the , did not exist
t1=: 0 : 0
1,2,3,4,5,6,7,8,9,0
2,999,1,2
)
_12345 ". ];._2 t1
1234567890 299912
NB. The normal is that the , separates numbers
1,2,3,4,5,6,7,8,9,0
1 2 3 4 5 6 7 8 9 0
2,999,1,2
2 999 1 2
"- negative sign (normally '-' but possibly also '_')"
t1=: 0 : 0
1,2,3,-4,5,6,7,8,9,0
2,_999,1,2
)
_12345 ". ];._2 t1
_12345 _12345
t1=: 0 : 0
1,2,3, -4,5,6,7,8,9,0
2, _999,1,2
)
_12345 ". ];._2 t1
_12345 _4567890
_12345 _99912
2006/11/7, Mark D. Niemiec <[EMAIL PROTECTED]>:
Anssi Sepp�l� <[EMAIL PROTECTED]> wrote:
> Yes, I have a number of dot <-> comma conversion utlities and J makes
> it fine. But I think that the !. (fit) with ". might be a "pure J"
> way to inform the decimal delimiter. Like
> ".!.',' '123,4'
> 123.4
Note that monadic ". performs J execution, and not numeric conversion.
If the above were to work, you would essentially be re-defining J's
rhematic
rules, and opening a fairly large can of worms, for example:
".!.',' 'z =, x +/ , * y'
Even if this applied only to the dyad, there are quite a few localization
issues
that you might want to address, rather than just one:
- decimal separator (normally '.' but sometimes ',')
- thousands separator (normally ',' but sometines '.')
- negative sign (normally '-' but possibly also '_')
- negative syntax (normally '-n' but possibly also 'n-', '(n)', etc.)
- positive sign (normally '+')
- exponent separator (normally one of 'dDeE')
- decimal digits (normally '0123456789' but other language like Arabic may
use others)
- digit direction (some scripts place leading digits first, some last)
The wide variety of issues makes this localization much more appropriate
to be handled externally, in most cases by very simple translation verbs.
Since all of J's internals use one consistent internal format for
converting and displaying numbers, it is best to ALWAYS treat user data
formats as being distinct from internal formats (How many users want
to see negative numbers displayed with an _ sign character?)
-- Mark D. Niemiec <[EMAIL PROTECTED]>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127
801 Grímsnes ,t-póst: [EMAIL PROTECTED]
Skype: gosiminn, gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm