Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #5570 Add doc for C# String.Split() #5581

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mushahidq
Copy link

Description

Added a new entry for String.Split() method in C#

Issue Solved

Issue #5570

Type of Change

  • Adding a new entry

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@CLAassistant
Copy link

CLAassistant commented Oct 31, 2024

CLA assistant check
All committers have signed the CLA.

@mamtawardhani mamtawardhani self-assigned this Nov 2, 2024
@mamtawardhani mamtawardhani added new entry New entry or entries c# C# entries status: under review Issue or PR is currently being reviewed labels Nov 2, 2024
Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mushahidq, thank you for contributing to Codecademy Docs, the entry is well written! 😄

I've requested some changes, could you please review and modify those at your earliest convenience? Thank you! 😃

Comment on lines 20 to 30
// Splits a string using a character as a delimeter
string[] subs = String.Split(char)

// Splits a string using a string as a delimeter
string[] subs = String.Split(string)

// Splits a string using a character as a delimeter into maximum substrings of the number specified in the second argument.
string[] subs = String.Split(char, Int)

// Splits a string using a character as a delimeter into maximum substrings of the number specified in the second argument.
string[] subs = String.Split(string, Int)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we separate these as follows:

Using a single character as a delimiter:

string[] subs = String.Split(char)

Using a string as a delimiter:

string[] subs = String.Split(string)

and others...

Comment on lines 33 to 36
`.Split()` is a method of class `String`. This method can take upto 3 parameters:
1. The first parameter is the delimeter and it can be a `Char`, an array of characters `Char[]`, or a `String`
2. The second parameter is optional and could be the manximum number of desired substrings which is specified as an integer of type `Int32`
3. The third parameter which is also optional could contain the split options `StringSplitOptions`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameters should be described in the following format:

  • char:
  • string:
    and other parameters

@@ -0,0 +1,116 @@
---
Title: '.Split()'
Description: 'Used to break string into substrings by specifying a delimeter.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: 'Used to break string into substrings by specifying a delimeter.'
Description: 'Divides a string into an array of substrings based on specified delimiters.'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description should begin with a verb

- 'paths/computer-science'
---

The `.Split()`** method breaks a string into substrings based on a delimeter which can be a character or another string and returns an array of strings
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `.Split()`** method breaks a string into substrings based on a delimeter which can be a character or another string and returns an array of strings
The **`.Split()`** method breaks a string into substrings based on a specified delimiter, which can be a character, an array of characters, or a string. It returns an array of strings containing the split substrings.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reframed for better clarity

@mamtawardhani
Copy link
Collaborator

Hey @mushahidq are you still working on this?

@mushahidq
Copy link
Author

Yes, I am. I'll make the requested changes by EOD

minor fixes
Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing to Codecademy Docs @mushahidq 😄

The entry looks good for a second round of review! 🚀

Console.WriteLine($"Substring: {sub}");
}

// To remove spaces too, we can specify ', ' as the delimeter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// To remove spaces too, we can specify ', ' as the delimeter
// To remove spaces, specify ', ' as the delimiter.

Console.WriteLine($"Substring: {sub}");
}

// To limit our substring to 2 we can specify the optional parameter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// To limit our substring to 2 we can specify the optional parameter
// To limit the number of substrings to 2, specify the optional parameter.

Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing to Codecademy Docs @mushahidq 😄

The entry looks good for a second round of review! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c# C# entries new entry New entry or entries status: review 1️⃣ completed status: under review Issue or PR is currently being reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants