6 kyu

WeIrD StRiNg CaSe

24,278 of 49,787xDranik
Description
Loading description...
Strings
Algorithms
  • Please sign in or sign up to leave a comment.
  • lekonai Avatar

    Tests for C# are incredibly inconsistent, sometimes accounting for the empty spaces as an indexable value and sometimes not

  • MatiasDePressa Avatar

    the test don't work in python

    to_weird_case should return the correct value for a single word 'ThIs ' should equal 'ThIs' 'Is ' should equal 'Is' Completed in 0.09ms should return the correct value for multiple words 'ThIs Is A TeSt ' should equal 'ThIs Is A TeSt' Completed in 0.03ms Completed in 0.20ms

  • vlfie Avatar

    This comment has been hidden.

  • ejini战神 Avatar

    No random tests in

    • CS

    • Ruby

  • ejini战神 Avatar

    Missing sample and fixed tests for empty string in almost all languages except C, C++, JS

  • ejini战神 Avatar

    PHP

    • No fixed tests

    • Random tests are not random :(

  • jle4e Avatar

    New here and newish to c++. was wondering if someone could clarify one point that isn't necessarilly specific to this kata but came to mind when trying to find a solution. the snippet of code given at the beginning of this kata included a return statement of the string_view (ie. return {str.begin(), str.end()}; ). None of the other solutions I saw kept this part of the code. Instead a lot of the solutions created a new string and returned the value of that string instead. Was I wrong in thinking that the solution needed to include this bit? Because I got stuck in trying to figure out how to modify the string_view if that was being returned. I finally just gave up and also changed the return statement to use a new string variable instead. Any help would be appreciated.

  • Andrewdwatters1 Avatar

    Great kata. Thanks

  • EndyPlus Avatar

    Good kata, but it is a 7 kyu level.

  • Mentat-Radnor Avatar

    Before clicking that the problem has been solved, you need to check the code. Everything is written very clearly here that the code with the wrong test is expected. P.S for MikChan(expected is an expectation from your test and it is not correct. since the first character must be uppercase)

  • Mentat-Radnor Avatar

    This comment has been hidden.

  • metatable Avatar
  • MikChan Avatar

    C++ Translation

    Please, review and approve/reject.

  • Vincin Christmas Avatar

    I am no expert, but this was easy enough to be classified as 7kyu, though I did notice some patterns in here that matched other six kyu problems that I couldn't solve

  • danik00111 Avatar

    omfg bonk.io wdb reference!!!!!!!

  • Koldrif Avatar

    In description said, that spaces will be presented only in case, where will be several words, but in test data there was string only with 4 spaces " ". So test didn't match the description.

  • arturobdev Avatar

    'ThIs iS A TeSt' to equal 'ThIs Is A TeSt' In this test, an output with capital letters in odd indices is expected, which does not agree with the instructions.

  • user4692717 Avatar

    incomplete description, the example shows even index letters in small. Not clear whether to count the "spaces" or not."Weird string case" => "WeIrD StRiNg CaSe", here the letter C is at 13th index but still is in upper case.

  • Xros22 Avatar

    great little string manipulation kata. really tightly constructed, pleasure to work out

  • MainaAlexM Avatar

    Issue with test cases: The kata says that even-indexed chars should be capitalized and odd-indexed chars, lowercased, but does not accept "ThIs iS A TeSt", even though the string satisfies both rules. The Kata therefore keeps on failing though the solution is right.

  • jcar23 Avatar

    I keep having this error, and I dont know why, it doensnt make sense... Its C#, this is the test I can't to get to work.

    Test Failed Whitespace should work too! Expected string length 4 but was 0. Strings differ at index 0. Expected: " " But was: <string.Empty> -----------^

  • SniperFrogen Avatar

    This comment has been hidden.

  • ESHughes Avatar

    Misleading acceptance criteria (C#).

  • 你的小居居 Avatar

    This comment has been hidden.

  • jayyyyyy Avatar

    Really bad description imo. Not sure why no one fixed it in so long.

  • Ibnballo1 Avatar

    There are always issues in codewars challenge! Kindly fix. When I work on it locally, the tests that failed in codewars worked correctly in vscode

  • hammzj Avatar

    The description needs a little more formatting to explain the acceptance criteria. It's hard to understand the requirements for this solution and it took much longer to determine what exactly was being asked. I think listing out the requirements and the notes about the indexing would help a lot better.

  • a1winter Avatar

    don't forget to remove the last space. Some solution will help

  • Dan D. Lyon Avatar

    I solved with the understanding that the same mutated object needed to be returned when the description stated return the "same string" but I noticed other people returned a string that was the same (in terms of the letter/space combination), but a different object altogether.

    This ambiguity leaves the possibility for two different possible solutions. One which outputs two strings that are equal when compared as case-insensitive versions OR the same string object, but mutated with indicated capitalizations, so might be worth clarifying!

  • amalsky Avatar

    This comment has been hidden.

  • Spencer06 Avatar

    Don't waste time on this kata. The index on string in examples vs test cases is not consistent

  • Alkari8 Avatar

    The tests are not consistent, in one they count spaces as an index of consideration, in another they don't count spaces

  • user9397914 Avatar

    Please, add to the description more detailes that spaces " " are not converted toWeirdCase and should be not included to indexation.

  • Limeedhot Avatar

    'ThIs Is A tEsT' should equal 'ThIs Is A TeSt' its just inconsistant the first space on the left it goes from lowercase s to uppercase I but then on the last spazce its uppercase A and uppercase T

  • Smith3G Avatar

    Everything is working correctly, but the tests are not running

    Test Results:

    toWeirdCase

    should return the correct value for a single word expected 'ThIs ' to equal 'ThIs'

    Completed in 2ms

    should return the correct value for multiple words expected 'ThIs Is A TeSt ' to equal 'ThIs Is A TeSt'

    Completed in 2ms

  • eslamD7 Avatar

    The problem should explicity state that each word is indexed seperately. Based on the explanation, "This is a test" should end up looking like "ThIs iS A TeSt" but the tests look for "ThIs Is A TeSt"

  • l96alex Avatar

    More like 7 kyu yeah

  • cukle289 Avatar

    Tests cases are good but description is not good , i want to say you if there's another word the counting will start from zero. For example:

    ThIs Is A TeSt --> every word counting starts at zero not as you think.

  • DINK74 Avatar

    Provided tests are inadequate. Some poorly written solutions slip thru. A test with all capital letters is strongly needed.

  • trashy_incel Avatar

    C translation (author gone)

  • tri@ Avatar
  • adamdresher Avatar

    Tests don't seem to be checking if the method is returning the same object as passed to it. I was able to pass tests by returning a new String.

    The tests can be appended to check object_id

  • osofem Avatar

    This is a good kata but the description is so poorly written. It took me 3 trials and reading through the discussions to finally understand what the kata is trying to achieve. I should not have to read the discussions to understand a kata.

  • robiulhr Avatar

    simple kata.

  • Zooram Avatar

    Took me a while to understand that each word starts new count! Nice Kata!

  • Andrew896 Avatar

    The kata says that even-indexed chars should be capitalized and odd-indexed chars, lowercased, but does not accept "ThIs iS A TeSt", even though the string satisfies both rules. Some users have observed that the "index" does not count spaces, but the term is never used this way in computer science, and no one would assume not to count spaces. If it is really the case that whitespace is not to be observed in the calculation of the "index", this should be specified in the kata.

  • Alpsboy-Jin Avatar

    Nice kata!

  • NicholasOkoth38 Avatar

    According to the condition it should be equal to "ThIs iS A TeSt", since every even character is uppercase remeber Even numbers UPPER Odd numbers lower Spaces Doesn't Count.

  • sukyose Avatar

    'ThIs iS A TeSt' should equal 'ThIs Is A TeSt' It means, its not counting the first space only. If iS going to Is, rest of the string had to "A tEsT" little problematic kata I suppose.

  • luke44 Avatar

    This kata has a poorly worded description. It should be rewritten to make it clearer that indexing starts again from 0 at each new word

  • MusicalCoder23 Avatar

    Please fix the golang tests. The spaces in some are counted in some and not in others.

  • sid114 Avatar

    in some tests, space counts as a char, while in others, it is not counted as an indexed char please clarify this

  • callinGudman Avatar

    This comment has been hidden.

  • MusaAbdillah Avatar

    the test is little bit weird, test not passed when i hit attempt button before test button. just hit test button first and then attempt button to pass this test.

  • atikrangnekar Avatar

    somebody there

  • fabian818 Avatar

    Please fix tests for Golang.

  • jdc866 Avatar

    Tests are not correct, per the instructions. A space has an index as well, which does not change the index of the following character. So that character still has an odd or even index, regardless. If you mean every-other character that is not a space, you should explicitly say that, rather than instructing to capitalize based on odd or even index.

    Please update either your instructions or the tests. The current version is not correct.

  • RachaelJane Avatar

    This comment has been hidden.

  • Algerd Avatar

    The problem with this kata, there is a test value "This is test" and according to the condition it should be equal to "ThIs iS A TeSt", since every even character is uppercase, but the test is not accepted and it says that the value should be equal to "ThIs Is A TeSt', but the letter i in the word is has index 5 and it should not be in uppercase

  • rahulbali Avatar

    The test cases for the Python language are not correct. Please fix them. These do not follow the actual statement written on the question.

  • user9644768 Avatar

    Please use new python test framework.

  • Alexnert Avatar

    Don't forget to use ToLower() . in some tests it does not work without it .

  • tecguy Avatar

    This comment has been hidden.

  • Krasnov8953 Avatar

    my solution with flatMap didn't passed

    function toWeirdCase(string) { return string.split('') .flatMap((item) => item.split('') .map((item, index) => index % 2 === 0 ? item.toUpperCase() : item.toLowerCase() ).join('') ).join(' ') }

  • Seralto Avatar

    This kata is wrong. Sometimes it counts the space, sometimes not.

  • ALowVerus Avatar

    Haskell says it only has "alphabetical characters and spaces", but it actually has special characters.

  • Urkchar Avatar

    Needs random tests for Python.

  • Halfasmurf Avatar

    It would avoid confusion if the instructions stated that each word starts with an uppercase.

  • fricewins Avatar

    It looks as if the golang tests are broken, since in some test cases the space should be taken and in others not

  • aeliz Avatar

    It seems as though the tests are contradictory - in some, the spaces are counted (and the letters on either side of the space share the same case), and in others they aren't. I've coded solutions for both scenarios and neither pass all of the tests.

  • user2616703 Avatar

    This comment has been hidden.

  • Ghost_Hash Avatar

    In JavaScript it's great challenge. !\Thanks

  • Graham G Avatar

    Nice twist making the case alternate reset for each word

  • PedroUzcategui Avatar

    This comment has been hidden.

  • airmorgzy Avatar

    Golang test cases seem to be wrong

  • ahmadbe Avatar

    This question and test cases is wrong

  • NexExMachina Avatar

    Oh wow finishing this one was fun ^_^

  • mcardle Avatar

    The exspected answer is also not correct in this (PHP) test case.

    testWeirdCaseConverter
      Failed asserting that two strings are equal.
      Expected: 'FoO YoU FoO PaSsEd ThIs'
      Actual  : 'FoO YoU FoO PaSsEd tHiS'
    
  • carmenhchung Avatar

    This comment has been hidden.

  • Charlei Kiwabs Avatar

    there is a problem with the test case, when i run my code somewhere else "boy" returns "BoY" but for these particular test cases, it returns "BOY".

  • dlcoe Avatar

    C# Description:

    The passed in string will only consist of alphabetical characters and spaces(' ').

    I came up with a bit manipulating solution that doesn't use any booleans or conditionals.
    It passed all the example test cases.
    Then I hit attempt and was bummed out to see that there can be many non-alphabetical characters other than space.

    Please update the description.

    ShouldWorkForMoreComplexStrings
    Test Failed
      String lengths are both 45. Strings differ at index 4.
      Expected: "OnCe, WhEn I WaS YoUnG, I CoDeD On ThE AmIgA!"
      But was:  "OnCeL WhEn I WaS YoUnGl I CoDeD On ThE AmIgAa"
      ---------------^
    Completed in 61.1820ms
    ShouldWorkForSymbols
    Test Failed
      Odd characters have to work
      String lengths are both 10. Strings differ at index 0.
      Expected: "!@#$%^&*()"
      But was:  "A`CdE~FjHi"
      -----------^
      
    
  • Anon162 Avatar

    the expected result for some test cases are not accurate

  • josue Avatar

    Test case is inconsistent. Getting the following error, however they are identical strings:

    Sample Test Cases:
    Should return the correct values
    
    Test Failed
    
    Expected
        <string>: AbC DeF 
    to equal
        <string>: AbC DeF
    
  • rabbit_binary7 Avatar

    Go translation kumited, please check and feel free to approve or reject it!

  • tlagr Avatar

    Seems likes there's an issue with the testing. If there's a space, the characters on either side should be the same case OR if we're supposed to ignore spaces, they should be opposites. Testing is inconsistent in that even within the same sentence they have both. (for Python)

  • jmw0149 Avatar

    Fails on 'ThIsIsATeSt' should equal 'ThIs Is A TeSt' There's nothing in the instructions about splitting a word into a sentence based on capitalization or removing spaces to create a long word. It's not clear which is input and which is output.

  • user8436785 Avatar

    PHP translation kumited, can someone please check it

  • phuongnguyen00 Avatar

    The rules for spaces between words are really confusing.

  • zstern Avatar

    This needs to definitly explicietly state that the zero indexing uppercase is for EACH WORD otherwise its super confusing.

  • cyphen21 Avatar

    Instructions regarding how to deal with spaces in between words were confusion. This alone caused me to waste twenty minutes. Reading back, I can see what the author intended, but this could have been made much clearer.

  • Talandris Avatar

    Test in Python are bad. Sometimes the " " counts and other times " " don't counts

  • kiran nandedkar Avatar

    why the first character is lower case when it says even is upper case and 0th index is even Assert.AreEqual("Is", Kata.ToWeirdCase("is"));

  • cbra Avatar

    3rd test in Ruby is inconsistent

    expected "ThIs Is A Test" should be "ThIs Is A tEsT"

    case doesn't alternate at "A Test" (i = 8 and 10; 'A T')

  • mendyc333 Avatar

    Based on the wording for the kata description: "Spaces will only be present if there are multiple words.", having the below test is inconsistent with that requirement.

    Test Failed Whitespace should work too! Expected string length 4 but was 0. Strings differ at index 0. Expected: " " But was: <string.Empty> -----------^

  • KPS-GitHub Avatar

    ThIs cHaLlEnGe iS StIlL BrOkEn aFtEr mOnThS. fIx YoUr tEsT CaSeS. i wAnT My SwEeT, sWeEt kYu.

  • randallgyebi Avatar

    The tests are inconsistent: Eg for 'LoOkS LiKe YoU PaSsEd'

    00: L 01: o 02: O 03: k 04: S
    05:
    06: L 07: i 08: K 09: e 10: 11: Y 12: o

    'Y' is odd but capitalised. Its either spaces count or dont count.

  • Azeforus Avatar

    Description should be more clear about indexing IMO. Took me a while to realize that it starts from zero for every word.

  • frejk Avatar

    This comment has been hidden.

  • angelhearted Avatar

    The tests lack cases when odd letters are uppercased. Some solutions, that leave the case of odd letters as is, are false passed currently.

  • scrow Avatar

    wrong for javascript. some test cases include the white spaces, others don't, when factoring in whether it is even or odd

  • jessigu Avatar

    yeah, test cases are wrong. sometimes a space is counted, sometimes not. not sure how to proceed on this one.

    for example: Expected: 'LoOkS LiKe YoU PaSsEd', instead got: 'LoOkS LiKe yOu pAsSeD' //The first space, after LoOkS, index 5, is counted and lowercase. Therefore index 6, the "L" of Like is uppercase. But the second space, after LiKe, index 10, is not counted in your test and forces index 11 to be uppercase.

  • aradenac Avatar

    C translation just Kumited with random tests ;)

  • user1619661 Avatar

    Holy shit all those wrong test cases. Be more careful when creating the tests. You messed up Haskell too: sometimes you didn't count space as a character and then put the wrong case on the next following character.

  • russellcain Avatar

    Test cases are inconsistent -- Unsure how to proceed :/

  • jrkenyon Avatar

    I think they forgot to count the spaces when doing this. Once I hit the first space in the tests everything is off by one.

  • tangweikun Avatar

    This comment has been hidden.

  • tuj Avatar

    JS test cases are incorrect. I was able to fix the Sample one, but I can't access the "Attempt" tests.

  • AntoMotos Avatar

    C# wRoNg test....

  • David Uriostegui Avatar

    This comment has been hidden.

  • rohith kattamuri Avatar

    for the test case: "this is a test", the expected case is incorrect.

  • RobAnthony01 Avatar

    The C# test cases are incorrect and do not give correct results. Some ignore spaces when doing the case change and some take them into account.

  • byteflux Avatar

    The parameters of the c# tests are the wrong way around. The expected value should be the first paramter, the actual one to test should come second.

  • vict Avatar

    Expected: "Z DwMhPsReRf G Lw"

    Expected: "ThIs is a test"

    How is this even possible? The test just doesn't work!! Ignore it and move on.

  • cmd-kvn Avatar

    I think it would also be useful to include more abstract test cases.
    For example:

    'START WITH CAPS' => 'StArT WiTh CaPs'  
    'wHO WrItES lIKe ThiS' => 'WhO WrItEs LiKe ThIs'
    

    This at least drives home from the details that odd characters must be lower cased.

  • tallpress Avatar

    Your examples are wrong, 'this is a test' should go to 'ThIs iS A TeSt' likewise for "WeIrD StRiNg CaSe", it should be "WeIrD StRiNg cAsE"

  • Vesprawn Avatar

    Intruction or Test case is wrong: "Expected: 'ThIs Is A TeSt', instead got: 'ThIs iS A TeSt'"

    "i" in "is" is the 5th index an odd number.

  • poxley Avatar

    Instructions are unclear (and misleading). To pass, the first letter of every word must be upper, and then remaining letters alternate upper/lower.

  • MoesDev Avatar

    Yes, test cases are wrong for multiple words.... inconsistent, I could solve for either counting the spaces or not but within each test sentence it goes back and forth

  • harshsikka123 Avatar

    The test case is wrong

  • bestwebua Avatar

    xDranik, thanks for the great kata! Cheers!

  • FranKrow Avatar

    Test cases are broken, some times takes the spaces as part of the sentences some not

  • Revorva Avatar

    'ThIs Is A TeSt' => the 'A' and 'T' in "A TeSt" breaks the proposed algorithem.

  • micmakarov Avatar

    Tests are broken. Some of them count space as character, some not.

  • sidjtd Avatar

    This practice needs to simply state that every letter needs to start with a capital no matter what since there quite a few ways you can go with this.

    • Just capitalize every other letter, regardless of spaces
    • Capitalize every other letter, but if there is a space, remember what the previous letter state was and either ignore or go ahead and capitalize.
    • Or like the solution, regardless of the final letter of the previous word, just capitalize all start of new words.
  • Ann0nym Avatar

    Test case is wrong!

  • master_liquid Avatar

    i don't think the case was wrong... it's just need other way to solve the case.. something like nested loop...

    that's why this case called weird.. hehe

  • jesabatini Avatar

    This comment has been hidden.

  • tuncelmert Avatar

    This comment has been hidden.

  • Rohini Avatar

    This test case is incorrect. test.assert_equals(to_weird_case('This is a test'), 'ThIs iS A TeSt')

  • crossphd Avatar

    OK, this was quite frustrating as many have pointed out, but I figured out what it is asking for. The instructions should say to evaluate each word separately, meaning you apply the upper and lower case anew on each word. It doesn't count spaces, and it doesn't matter what the case of the last letter in the previous word is. You start the index count over again with each word.

    Hopefully this helps aleviate some frustration for others.

  • alec99 Avatar

    poorly written instructions i have the same problem as @yk2kus

  • codevbus Avatar

    Test case still appears to be wrong.

  • apoorlydrawnape Avatar

    HORRIBLE YOU CANT SOLVE IT, DO NOT DO IT

  • Turbo104 Avatar

    This one kinda pissed me off. The directions are unclear. I guess this is a lession in providing what the cusomer wants vs what they explicity said :) As others have said, Make sure you are indexing every WORD not the string as a whole.

  • ElielHdez Avatar

    Great kata! Kudos!

  • jimcrick93 Avatar

    This kata is broken.

  • Insolublepancake  Avatar

    To echo other users: this test is poorly designed, the test cases are inconsistent. The case of letters either side of a sing space should always be the same.

  • yk2kus Avatar

    Test case was wrong, it should be for python. test.assert_equals(to_weird_case('This is a test'), 'ThIs iS A TeSt')

  • ekailia Avatar

    Cases are inconsistent. Problems on how to handle indexes around a space. one test case expects 'Ok FiNe YoU ArE DoNe NoW'.

  • monajalal Avatar

    This comment has been hidden.

  • Javatlacati Avatar

    Java translation Kumited! Please accept :D

  • LiuYao Avatar

    One of the tests required that 'ThIsIsATeSt' should equal 'ThIs Is A TeSt'. Is there something wrong with the tests?

  • manoj10690@gmail.com Avatar

    test cases are not correct. 'this is a test' should change to ThIs iS A TeSt.

    Problem statement does not seems to be correct please help.

  • gomesalexandre Avatar

    Instructions should be more clear, and there should be some random test cases for the js version of the kata..! It was good otherwise.

  • donaldsebleung Avatar

    Javascript version of Kata could ideally include some random test cases as well as fixed tests. Furthermore, I would refrain from constructing the fixed tests directly using (your) "official solution" unless you are 100% sure that your "official solution" performs the algorithm correctly as expected.

  • Salitter Avatar

    Poorly designed test. Instructions are very unclear.

  • cmhchoi Avatar

    Instruction is very unclear - it doesn't explicitly say index of the letter in each word. Instead, one would assume the question is asking for the index of the letter in the entire string.

  • cumbach Avatar

    Definitely unclear, directions should explicitly state that its the index OF EACH WORD and NOT the index of the entire STRING...

  • tu6619 Avatar

    This comment has been hidden.

  • DryFlyRyan Avatar

    The test cases appear to be both wrong and inconsistant. This is true if you use the array's natural index as well if you use a counter and skip spaces.

    Really just a poorly designed test.

  • Katbow Avatar

    I am unsure if spaces are to be ignored or not. In the given example toWeirdCase( "Weird string case" );//=> returns "WeIrD StRiNg CaSe" it seems that spaces are NOT ignored, but in the given test case Test.assertEquals(toWeirdCase('This is a test'), 'ThIs Is A TeSt'); it appears that they are.

    Could you clarify if the spaces are to be ignored or not? Thanks!

    Edit: Doh, I found the correct answer in a reply to another comment. Spaces are ignored, as it's every other character in each word.

  • rjcarr Avatar

    The example test case is incorrect given the instructions. This:

    Test.assertEquals(toWeirdCase('This is a test'), 'ThIs Is A tEsT');
    

    Should actually be:

    Test.assertEquals(toWeirdCase('This is a test'), 'ThIs Is A TeSt');
    

    Strangely, it seems this same test is performed on the submission with the correct result. To put another way, the example tests will fail on a correct solution.

    I know the example tests are just for guidance, but you expect them to be accurate, especially when the description isn't super clear.

  • Unnamed Avatar

    Python translation published.

  • burythehammer Avatar

    Test cases aren't consistant, at least for ruby. The capitalisation for some of the expected cases misses the space, and others include the space. Note how in test case 1 you end up with capitals either side of a space, between "A" and "TeSt", whereas you end up with lower/upper case either side of "ThIs" and "Is". It isn't hard for me to put in the logic to skip spaces or not, but as it stands, these test cases are impossible to fulfil.

    1 Expected: "ThIs Is A TeSt", instead got: "ThIs iS A TeSt" 2 Expected: "LoOkS LiKe YoU PaSsEd", instead got: "LoOkS LiKe yOu pAsSeD" 3 Expected: "ThIs Is ThE FiNaL TeSt CaSe", instead got: "ThIs iS ThE FiNaL TeSt cAsE" 4 Expected: "JuSt KiDdInG", instead got: "JuSt kIdDiNg" 5 Expected: "Ok FiNe YoU ArE DoNe NoW", instead got: "Ok fInE YoU ArE DoNe nOw"

  • yoshikischmitz Avatar

    The description says that only alphabetical characters will be used but the random tests in the Haskell version uses special characters.

  • brntsllvn Avatar

    It appears map_with_index and collect_with_index are turned off. Could be wrong. But, if so, please explicitly say as much. Thanks.

  • canna Avatar

    I think your test case has a little problem

  • d3chapma Avatar

    The problem should explicity state that each word is indexed seperately. Based on the explanation, "This is a test" should end up looking like "ThIs iS A TeSt" but the tests look for "ThIs Is A TeSt"

  • PatrickO10 Avatar

    This comment has been hidden.

  • SkyBirdSoar Avatar

    Please explicitly state that every word must begin capitalized.

  • jasonmenayan Avatar

    I'm kind of a beginner, and came up with a solution without the .split, .map, or .join methods and callbacks...but I would LOVE to put these into practice, like some of the elegant solutions I've looked at.

    Can anyone suggest kata that would allow me to practice callbacks and methods like these? (I looked at the best solution and understand it conceptually, but would like to try to do the same several more times.)

  • bdx Avatar

    None of the test cases correctly test for the odd indexed characters being lowercased.

    An additional test case to check for that should be performed in both the words and sentences blocks:

    • Add "tEsT" to words
    • Add "This is A TEST" to sentences.
  • stuartflgray Avatar

    Oh whoops I was indexing the entire string rather than each word separately

  • noHare Avatar

    This comment has been hidden.

  • aespinoza Avatar

    My tests are passing but it won't let me submit. I even tested myself on my computers console via irb. Ruby. Hmmm...

  • mlabrum Avatar

    Are the test expectations incorrect when spaces are included, or am I misreading something? The description gives the following example: weirdcase( "Weird string case" );#=> returns "WeIrD StRiNg CaSe" where the "s" in "string" is capitalized because its index is 6. But when I test my code, Test Failed: Expected: "ThIs Is A TeSt", instead got: "ThIs iS A TeSt" where the expectation is the "i" in "is" is capitalized, even though its index is 5.

  • romanzes Avatar

    "all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased"
    <naggermode>In fact, the opposite is true: first character (odd) must be upper cased, second character (even) must be lower cased, etc. Or you should mention that numeration starts at zero, which is an even character. I know, we're all programmers here, but people don't count from zero.</naggermode>