|
[Date Index]
[Thread Index]
[Author Index]
Simplest way to get 2 digits from an integer...
- To: mathgroup at smc.vnet.net
- Subject: [mg110930] Simplest way to get 2 digits from an integer...
- From: Murta <rodrigomurtax at gmail.com>
- Date: Mon, 12 Jul 2010 01:04:44 -0400 (EDT)
Hello All
I would like to find a simplest code to take the first n digits os a integer.
Here are two examples (not simple) to take the first 2 digits os the number a:
1)
a = 1234;
ToExpression@StringTake[ToString[a], 2]
12
2)
a = 1234;
FromDigits@Take[IntegerDigits[a],2]
12
-------
In Excel, I just use Left(a,2)*1 (multiply by 1 to get a number,
instead of text)
There is one simplest way in Mathematica!?
thanks in advance
Rodrigo Murta
Prev by Date:
Stem and Leaf Question
Next by Date:
Re: Fast pricer for American options
Previous by thread:
Re: Stem and Leaf Question
Next by thread:
Re: Simplest way to get 2 digits from an integer...
|