TopCoder problem "CalcTest" used in SRM 246 (Division II Level One)



Problem Statement

    

You are developing a new software calculator. During the testing phase of the software you have found that the test cases use different symbols as the decimal point of floating numbers. Moreover some test cases contain useless space symbols. Now you want to bring the numbers to a unified format.

You will be given a String[] numbers. Remove all space symbols (ASCII code 32) from the given numbers and replace each non-digit symbol with a dot symbol ('.'). You should not make any other changes to the numbers.

 

Definition

    
Class:CalcTest
Method:uniform
Parameters:String[]
Returns:String[]
Method signature:String[] uniform(String[] numbers)
(be sure your method is public)
    
 

Constraints

-numbers will have between 1 and 50 elements, inclusive.
-Each element of numbers will contain between 1 and 50 characters, inclusive.
-Each character in numbers will have ASCII code between 32 and 127, inclusive.
-Each element of numbers will contain at most one non-space non-digit symbol.
-Each element of numbers will contain at least one digit.
 

Examples

0)
    
{"1.5", "2$ 3", "12 3"}
Returns: {"1.5", "2.3", "123" }
1)
    
{",5", "3,", ".5", "3.", "000,000", "000 000"}
Returns: {".5", "3.", ".5", "3.", "000.000", "000000" }
2)
    
{"263C45233 ", " 2364A56", "B273664"}
Returns: {"263.45233", "2364.56", ".273664" }

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=4469

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=7221&pm=4469

Writer:

Andrew_Lazarev

Testers:

PabloGilberto , lbackstrom , brett1479

Problem categories:

String Manipulation