{"id":16565172,"url":"https://github.com/shonharsh/csharp-exercism-s05e01-tuples-phonenumberanalysis","last_synced_at":"2026-04-06T21:31:18.912Z","repository":{"id":244441976,"uuid":"815254821","full_name":"ShonHarsh/CSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis","owner":"ShonHarsh","description":"Exercism - This C# project is about tuples and analyzing phone numbers.","archived":false,"fork":false,"pushed_at":"2024-06-17T22:02:43.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T08:35:54.264Z","etag":null,"topics":["academic","artificial-intelligence","atom","automation","bot","config","csharp","education","git","guide","learning","markdown","phone-number","process","studio","testing","training-materials","trending","tuples","windows"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShonHarsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-14T17:33:20.000Z","updated_at":"2024-06-22T01:48:06.000Z","dependencies_parsed_at":"2024-06-14T18:59:42.999Z","dependency_job_id":"dfbad1ec-1c06-43de-adba-62beedf5028b","html_url":"https://github.com/ShonHarsh/CSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis","commit_stats":null,"previous_names":["shonharsh/csharp-exercism-s05e01-tuples-phonenumberanalysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ShonHarsh/CSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FCSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FCSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FCSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FCSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShonHarsh","download_url":"https://codeload.github.com/ShonHarsh/CSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShonHarsh%2FCSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31491096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["academic","artificial-intelligence","atom","automation","bot","config","csharp","education","git","guide","learning","markdown","phone-number","process","studio","testing","training-materials","trending","tuples","windows"],"created_at":"2024-10-11T20:46:18.551Z","updated_at":"2026-04-06T21:31:18.886Z","avatar_url":"https://github.com/ShonHarsh.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Banner](Data/Images/CSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis.png)\n\n### CSharp-Exercism-S05E01-Tuples-PhoneNumberAnalysis\n\nThis repository my work for the [Exercism](https://exercism.org/) C# track.\n\n### Download Command\n`exercism download --track=csharp --exercise=phone-number-analysis`\n\n### Submission Command\n`exercism submit \"Exercism\\csharp\\log-analysis\\PhoneNumberAnalysis.cs\"`\n\n![Banner](Data/Images/CSharp-Exercism-S05-Tuples-Title.png)\n\n# Phone Number Analysis\n\nWelcome to Phone Number Analysis on Exercism's C# Track.\nIf you need help running the tests or submitting your code, check out `HELP.md`.\nIf you get stuck on the exercise, check out `HINTS.md`, but try and solve it without using those first :)\n\n## Introduction\n\n## Tuples\n\nIn C#, a tuple is a data structure which organizes data, holding two or more fields\nof any type.\n\nA tuple is typically created by placing 2 or more expressions separated by commas,\nwithin a set of parentheses.\n\n```csharp\nstring boast = \"All you need to know\";\nbool success = !string.IsNullOrWhiteSpace(boast);\n(bool, int, string) triple = (success, 42, boast);\n```\n\nA tuple can be used in assignment and initialization operations, as a return value or a method argument.\n\nFields are extracted using dot syntax. By default, the first field is `Item1`,\nthe second `Item2`, etc. Non-default names are discussed below.\n\n```csharp\n// initialization\n(int, int, int) vertices = (90, 45, 45);\n\n// assignment\nvertices = (60, 60, 60);\n\n//  return value\n(bool, int) GetSameOrBigger(int num1, int num2)\n{\n    return (num1 == num2, num1 \u003e num2 ? num1 : num2);\n}\n\n// method argument\nint Add((int, int) operands)\n{\n    return operands.Item1 + operands.Item2;\n}\n```\n\nField names `Item1` etc. do not make for readable code. The code below shows\n2 ways to name the fields of tuples. Note also, in the code below, that `var` can be used with tuples and the type inferred. This works equally well for tuples with named and unnamed fields.\n\n```csharp\n// name items in declaration\n(bool success, string message) results = (true, \"well done!\");\nbool mySuccess = results.success;\nstring myMessage = results.message;\n\n// name items in creating expression\nvar results2 = (success: true, message: \"well done!\");\nbool mySuccess2 = results2.success;\nstring myMessage2 = results2.message;\n```\n\n## Instructions\n\nThis exercise has you analyze phone numbers.\n\nYou are asked to implement 2 features.\n\nPhone numbers passed to the routines are guaranteed to be in the form\nNNN-NNN-NNNN e.g. 212-515-9876 and non-null.\n\n## 1. Analyze a phone number\n\nYour analysis should return 3 pieces of data\n\n1. An indication of whether the number has a New York dialing code ie. 212 as the first 3 digits\n2. An indication of whether the number is fake having 555 as a prefix code in positions 5 to 7 (numbering from 1)\n3. The last 4 digits of the number.\n\nImplement the (static) method `PhoneNumber.Analyze()` to produce the phone number info.\n\n```csharp\nPhoneNumber.Analyze(\"631-555-1234\");\n// =\u003e (false, true, \"1234\")\n```\n\n## 2. Detect if a phone number has a fake prefix code (555)\n\nImplement the (static) method `PhoneNumber.IsFake()` to detect whether the phone number is fake using the phone number info produced in task 1.\n\n```csharp\nPhoneNumber.IsFake(PhoneNumbers.Analyze(\"631-555-1234\"));\n// =\u003e true\n```\n\n## Source\n\n### Created by\n\n- @mikedamay\n\n### Contributed to by\n\n- @ErikSchierboom\n- @yzAlvin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshonharsh%2Fcsharp-exercism-s05e01-tuples-phonenumberanalysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshonharsh%2Fcsharp-exercism-s05e01-tuples-phonenumberanalysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshonharsh%2Fcsharp-exercism-s05e01-tuples-phonenumberanalysis/lists"}