[Javascript] removing periods
Håkan Magnusson
hakan at backbase.com
Thu Mar 11 07:11:48 CST 2004
Of course, my regexp should have been
TOTAL.replace(/\./, '', 'g');
then you won't need the while loop.
There is a need to escape the period in regular expressions, since '.'
means 'everything' (except newlines, unless DOTALL etc etc). There is
however no need to use a regular expression in this case, I just love
regexps. :)
Regards,
H
flavio wrote:
> while(TOTAL.indexOf('.') != -1)
> {TOTAL.replace('.', '')}
>
> Question: Is there a need to 'escape' the period? (If there is, DO it. =P)
>
> Citando Håkan Magnusson <hakan at backbase.com>:
>
>
>>Have you tried
>>
>>TOTAL.replace(/\./, '');
>>
>>?
>>
>>Regards,
>>H
>>
>>Paul McGuire wrote:
>>
>>
>>>I have a string of values
>>>
>>>E.G
>>>
>>>1.00,2.00,3.00,4.00,1.01,1.10
>>>
>>>I build this string up in a loop that reads textboxes in a form. The
>>>variable This string is then stored in is called TOTAL
>>>
>>>E.G
>>>
>>>TOTAL = "1.00,2.00,3.00,4.00,1.01,1.10"
>>>
>>>I need to be able to remove all the . from the variable TOTAL so the
>>
>>string
>>
>>>is.
>>>
>>>100,200,300,400,101,110
>>>
>>>I expect a regular expression or TOTAL.replace is needed but I cant seem
>>
>>to
>>
>>>get anything to work.
>>>
>>>Thanks
>>>
>>>Paul McGuire
>>>
>>>_______________________________________________
>>>Javascript mailing list
>>>Javascript at LaTech.edu
>>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>>
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>
>
>
>
>
> ---------------------------------------------------------------------
> Mensagem enviada através do WebMail NetSol (http://www.netsol.psi.br)
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
More information about the Javascript
mailing list