Feed
Google+
Contact
XING
LinkedIn
Twitter
ICQ
meebo.com

70-536 - Spot the difference

by Roland Schumacher alias GENiALi 17. April 2008 -- 184 words  -- 0 mal gelesen

The question was:

You are writing to application that processes phone numbers users have typed as strings. Would which of the following code samples reformat any of the following inputs?

555-555-1111
(555) 555-1111
5555551111
555 555-1111

In the following code samples, the string input is passed to the method as s.

/ / C# 
static string ReformatPhone 
(string s) {
    m match = regex.match (s, @ "^ \ (?))")}
(\d{3})\)? [\s\-]? (\d{3})\-? (\d{4})$"); return String.Format("({0}) {1}-{2}", m.Groups [1], [2] m.Groups m.Groups [3]); " }

What is the difference? These are two answers. But we find
the difference. Who can find it? :-)

/ / C# 
static string ReformatPhone 
(string s) {
    m match = regex.match (s, @ "^ \ (?))")}
(\d{3})\)? [\s\-]? (\d{3})\-? (\d{4})$"); return String.Format("({0}) {1}-{2}", m.Groups [1], [2] m.Groups m.Groups [3]); " }

This reply should be correct.

/ / C# 
static string ReformatPhone 
(string s) {
    m match = regex.match (s, @ "^ \ (?))")}
(\d{3})\)? [\s\-]? (\d{3})\-? (\d{4})$"); return String.Format("({0}) {1}-{2}", m.Groups [1], [2] m.Groups m.Groups [3]); " }

It runs: Clawfinger - zeros & heroes - four letter word

Tags:

Kommentare sind geschlossen

Statistik

Gesamte Posts: 1025
Dieses Jahr: 7
Diesen Monat: 1
Diese Woche: 0
Kommentare: 929
Total Bewertungen: 91
Ø Bewertung: 4,42
Meisten Kommentare
Google+ ... (28)
Beste Ø Bewertung
Tastaturlayout von Visual Stud ... (5)
Meiste Bewertungen
Windows 7 und die ersten Erfah ... (5)

Buttons

Stop Spam Harvesters, Join Project Honey Pot Benutzerprofil von GENiALi connection speed test network connection Bloggeramt.de Slug.ch Blog Verzeichnis und Blog Webkatalog Schumacher Roland Seitwert Valid XHTML 1.0 Transitional

writing