NUMFMT_PARSE(3) 1 NUMFMT_PARSE(3)NumberFormatter::parse - Parse a number
Object oriented style
SYNOPSIS
public mixed NumberFormatter::parse (string $value, [int $type], [int &$position])
DESCRIPTION
Procedural style
mixed numfmt_parse (NumberFormatter $fmt, string $value, [int $type], [int &$position])
Parse a string into a number using the current formatter rules.
PARAMETERS
o $fmt
-NumberFormatter object.
o $type
- The formatting type to use. By default, NumberFormatter::TYPE_DOUBLE is used.
o $position
- Offset in the string at which to begin parsing. On return, this value will hold the offset at which parsing ended.
RETURN VALUES
The value of the parsed number or FALSE on error.
EXAMPLES
Example #1
numfmt_parse(3) example
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo numfmt_parse($fmt, $num)."
";
echo numfmt_parse($fmt, $num, NumberFormatter::TYPE_INT32)."
";
?>
Example #2
OO example
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo $fmt->parse($num)."
";
echo $fmt->parse($num, NumberFormatter::TYPE_INT32)."
";
?>
The above example will output:
1234567.891
1234567
SEE ALSO numfmt_get_error_code(3), numfmt_format(3), numfmt_parse_currency(3).
PHP Documentation Group NUMFMT_PARSE(3)
Check Out this Related Man Page
NUMFMT_PARSE_CURRENCY(3) 1 NUMFMT_PARSE_CURRENCY(3)NumberFormatter::parseCurrency - Parse a currency number
Object oriented style
SYNOPSIS
public float NumberFormatter::parseCurrency (string $value, string &$currency, [int &$position])
DESCRIPTION
Procedural style
float numfmt_parse_currency (NumberFormatter $fmt, string $value, string &$currency, [int &$position])
Parse a string into a double and a currency using the current formatter.
PARAMETERS
o $fmt
-NumberFormatter object.
o $currency
- Parameter to receive the currency name (3-letter ISO 4217 currency code).
o $position
- Offset in the string at which to begin parsing. On return, this value will hold the offset at which parsing ended.
RETURN VALUES
The parsed numeric value or FALSE on error.
EXAMPLES
Example #1
numfmt_parse_currency(3) example
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY );
$num = "1.234.567,89xc2xa0$";
echo "We have ".numfmt_parse_currency($fmt, $num, $curr)." in $curr
";
?>
Example #2
OO example
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::CURRENCY );
$num = "1.234.567,89xc2xa0$";
echo "We have ".$fmt->parseCurrency($num, $curr)." in $curr
";
?>
The above example will output:
We have 1234567.89 in USD
SEE ALSO numfmt_get_error_code(3), numfmt_parse(3), numfmt_format_currency(3).
PHP Documentation Group NUMFMT_PARSE_CURRENCY(3)
I'm haveing trouble with my php script.
the second line is giving me trouble.
for ($num = 70; $num < 150 ; $num++) {
$test = ereg_replace("<","<",str_rot13($temp,$num));
echo "#$num <BR>" . $test . "<HR>";
I keep getting this error "Warning: str_rot13() expects exactly 1 parameter,... (1 Reply)
Hi,
I am running this command, to know abt the "for" loop command
echo " enter how many numbers you want to give"
read num
for i in 1 .. num
do
echo "Hi this is the $i message"
done
if i give the input as 3 then
i shd get the output like
Hi this is the 1 message
Hi this is... (8 Replies)
Here is the file named tuwork..........
209 200 WZ 6529 SKTNCA01X4X C POI LODI LODI 738 SKTNCA0127T LOD
Here is the scipt.......
cat tuwork |
while
read rva
do
num=`echo $rva | cut -d" " -f1-2`
reg=`echo $rva | cut -c10`
ocn=`echo $rva | cut -c12-15`
x=`echo $rva | cut -c29`... (3 Replies)
Hello,
I barely know the basics, but I am very determined to learn. I want to parse a few characters from each row, use that string to search another file and display the line number where I found the value in the file. I don't know if this can all be done on the command line, so I am creating a... (2 Replies)
I have treid searching for what I thought would be a common question...but to no avail.
I have to long numbers (4-8) digits. how can I format them so they are printed as 1,234,567 rather than 1234567? I have no idea where to start, have played with varying types of awk, print, substr.
Also,... (10 Replies)
I have a string as "Period= 20090531 Client Name= Clayton Lumbar Company Destination= MD"
I want to parse the string and store it in 3 different variables.
$period (should get value 20090531)
$client (should get value "Clayton Lumbar company")
$dest (should get value MD)
How can I do... (3 Replies)
File 1
<html>ta da....unique file name I want to give file=>343...</html>
<html>da ta 234 </html>
<html>pa da 542 </html>
and so on...
File 2
343
234
542
and so on, each line in File 1 one also corresponds with each line in File 2
I have tried several grep, sed, while .. read, do,... (4 Replies)
Hi Everybody
I am a newbee to the unix scripting.
i had a string like Id: 1234567, length 7
can you please help me to get only 1234567 (no coma) from string.
thanks in advance. (1 Reply)
i want to print ODD lines like first ,third then fifth and so on
234,567,ABC,KJL
234,565,ABD,KJL
234,568,ABE,KJL
234,560,ABF,KJL
234,563,ABG,KJL
234,562,ABH,KJL
O/P will be like
234,567,ABC,KJL ----->first liine
234,568,ABE,KJL ----->third line
234,563,ABG,KJL ----->fifth line... (6 Replies)
Hi,
I want to parse nested variable in my script.
for exp-
c=1
G1='0318'
G2='0023'
G3='3092'
G4='0014'
while ;do
g=G$c
a=$g
echo "Group=$g and value=$a"
c=`expr $c + 1`
done
final output are as -
---------------------------
Group=G1 and... (4 Replies)
I have a section of text in file A, see below
# falkdjf lkjadf lkjadf
lkajdf lkajdf lkajdf lkjadf
lkjadf 234.234.2.234
lkjlkjlk 234.234.3.234
#
Only the first line with "# falkdjf lkjadf lkjadf" is unique in the file. The new section that I want to overwrite the old section above is in... (1 Reply)
Hi,
I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the... (2 Replies)
Hi there, would appreciate some help on this parsing problem if anybody can help
im trying to parse a variable with the following output, each of the values im trying to parse are deliminated by a ;
T192... (8 Replies)
Hi,
I have a string which can be completely unstructred. I am looking to parse out values within that String.
Here is an example
<Random Strings> String1=<some number a> String2=<some number b> String3=<some number c> Satish=<some number d> String4=<some number e>
I only want to parse out... (1 Reply)