473,486 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

urgent need help regarding formatting/parsing

hi all,
i m using this function in javascript but there is problem.
function thousandseparator(val)
{
var regexpr=new RegExp('(-?[0-9]+)([0-9]{3})');
while(regexpr.test(val))
{
val=val.replace(regexpr,'$1,$2');
}
return val;
}
but it sometimes gives output as 1,2,345 while i use onblur and alert.
how can i resolve it?
how i change the string 123,456 into number 123456??
thx
Mar 12 '08 #1
1 1112
Use split on the comma(s) and reconcatenate the data but the better solution
would be trying to refine the expression and not getting unwanted formatting
in the first place. I get upset with RegEx as it is not used frequently
enough and has to be relearned everytime it needs to be used. Good luck to
ya.

"CreativeMind" <af*********@gmail.comwrote in message
news:d1**********************************@x41g2000 hsb.googlegroups.com...
hi all,
i m using this function in javascript but there is problem.
function thousandseparator(val)
{
var regexpr=new RegExp('(-?[0-9]+)([0-9]{3})');
while(regexpr.test(val))
{
val=val.replace(regexpr,'$1,$2');
}
return val;
}
but it sometimes gives output as 1,2,345 while i use onblur and alert.
how can i resolve it?
how i change the string 123,456 into number 123456??
thx
Mar 12 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
9423
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
287
by: dinoo | last post by:
I need your help I want to know what other options user have if he does not have Microsoft Word on his machine I would like to use word sort of application for formatting documents, these...
8
5206
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
2
1525
by: sachin | last post by:
Hello Everybody I need some help regarding Natural Language Processing. I am designing a MT system from a SOV language to a SOV language. I need a parser which can find the root word...
0
1027
by: tom lewton | last post by:
IGotYourDotNet wrote: > I have a treeview on my for and I need to write all the nodes, parent, > child to an XML file, How can i do that? Write a recursive function? Here's an example: //...
18
3012
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
16
2888
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
5
3025
by: mrid via DotNetMonster.com | last post by:
hi. im exporting data from a vb form to excel. i am able to create a new excel file, save and edit it without any trouble, but the formatting is giving me hell! i need to be able to show certain...
1
1248
by: lckarthikeyan | last post by:
I Have one doubt in parsing function in c... In my program i am using one object identifier like this 1.3.6.7.184 now i want to change like this using parsing function 1_3_6_10_184.. any...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.