#Log Analysis
20 messages · Page 1 of 1 (latest)
Hi, if you share your code and your error message (in code blocks - use 3x backticks before and after) it's way easier to help than just guessing 😉
What language are you writing in?
How you ask questions makes a huge difference in the help we can provide. Learn how to write good support requests in this article: http://bit.ly/howto-ask
in c#
Sure
public static class LogAnalysis
{
public static string SubstringAfter(string logAnalysis)
{
return logAnalysis.Substring.Split(":");
}
}
Is this the entire code or is there something missing?
If this is the entire code, would you share the error message too?
PS: The backticks i mentioned earlier, if you use them you get a better formating for your code
like this
how can i do backticks?
depending on what keyboardlayout you use, try to find the key that has a ´ and below that a ` symbol
us keyboards have if tleft to the 1 key
okok meanwhile i write the entire code and now it work but i don't understand the previus error ahahah
this is my new code
`public static class LogAnalysis
{
public static string SubstringAfter(this string log ,string delimiter)
{
return log.Split(delimiter)[1];
}
public static string SubstringBetween(this string log ,string d1 , string d2)
{
return log.Split(d1)[1].Split(d2)[0];
}
public static string Message(this string log )
{
return log.SubstringAfter(": ");
}
public static string LogLevel(this string log )
{
return log.SubstringBetween("[","]");
}
}`
There is a way to write it better?
And which test is failing? What’s the output?
I assume it's something about trying to return a string array but the method signature is expecting to return a string. https://learn.microsoft.com/en-us/dotnet/api/system.string.split?view=net-9.0#system-string-split(system-string-system-stringsplitoptions)
I don’t see a string array being returned. Each split is followed by an element being retrieved.
Causethisis thetask of my Exercise in exercism
i think..😅
Thanks
Ah, I missed that the latest code snippet was one that passed the tests, not the code that was incorrect. Ignore my last comment which was directed at glennj.
As for feedback on a passing solution, that's what mentoring sessions are intended for on the website. This channel is for getting unstuck on an exercise, and the tests pass so you're good to go.
Increase your chance of getting help and look like a pro by sharing codeblocks not images. For example, you can type the following. Note, the ``` must be on their own line.
```
for number in range(10):
total += number;
```
Discord will render that as so:
for number in range(10):
total += number;
Click here to learn more about codeblocks: https://exercism.org/docs/community/being-a-good-community-member/writing-support-requests and http://bit.ly/howto-ask