Split it. But not all!

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Inspired by this StackOverflow question.



Input:



We'll take three inputs:



  • A delimiter-character D to split on

  • A character I within we ignore the character to split on (I know, that sounds vague, but I'll explain it below)

  • A string S

Output:



A list/array containing the substrings after the split.



Example:



Input:
D = ','
I = '"'
S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'

Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']


Why? Splitting on comma would normally also split 98,00, 12,000,000 and ,-, in two/three pieces. But because they are within the I input character, we ignore ignore the split here.



Challenge rules:



  • You can assume there will always be an even amount of I characters in the input-string.

  • You can assume the character I will always have a D next to it (except when it's the first or last character of the input). So you won't have something like D = ','; I = '"'; S = 'a,b"c,d"e,f'.

  • The input-string S could contain none of either D or I. If it contains no D, we output a list with the entire input-string as only item.

  • The output list won't contain the character I anymore, even when it contained no D (as you can see at the "Abc " becoming 'Abc ' in the example above).

  • It is possible that the substring within I contains only D. For example: D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f' would result in ['a', ',', 'b', 'c', 'd,e,,', 'f'].

  • When an input has a leading or trailing D, or two adjacent D, we'll have an empty item. I.e. D = ','; I = '"'; S = ',"a,b",c,,d,""' would result in ['', 'a,b', 'c', '', 'd', ''].

  • You can assume the inputs and outputs will only contain printable ASCII in the range [32, 126] (so excluding tabs and newlines).

  • You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.

Test cases:



Input:
D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']

Input:
D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
Output:
['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']

Input:
D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
Output:
['a', ',', 'b', 'c', 'd,e,,', 'f']

Input:
D = ','; I = '"'; S = ',"a,b",c,,d,""'
Output:
['', 'a,b', 'c', '', 'd', '']

Input:
D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
Output:
['contains no lowercase X nor Y']

Input:
D = ' '; I = 'I'; S = "I'll remove all I"
Output:
["", "'ll remove all ", ""]

Input:
D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']

Input:
D = ' '; I = 'S'; S = 'regular split on spaces'
Output:
['regular', 'split', 'on', 'spaces']









share|improve this question

























    up vote
    1
    down vote

    favorite












    Inspired by this StackOverflow question.



    Input:



    We'll take three inputs:



    • A delimiter-character D to split on

    • A character I within we ignore the character to split on (I know, that sounds vague, but I'll explain it below)

    • A string S

    Output:



    A list/array containing the substrings after the split.



    Example:



    Input:
    D = ','
    I = '"'
    S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'

    Output:
    ['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']


    Why? Splitting on comma would normally also split 98,00, 12,000,000 and ,-, in two/three pieces. But because they are within the I input character, we ignore ignore the split here.



    Challenge rules:



    • You can assume there will always be an even amount of I characters in the input-string.

    • You can assume the character I will always have a D next to it (except when it's the first or last character of the input). So you won't have something like D = ','; I = '"'; S = 'a,b"c,d"e,f'.

    • The input-string S could contain none of either D or I. If it contains no D, we output a list with the entire input-string as only item.

    • The output list won't contain the character I anymore, even when it contained no D (as you can see at the "Abc " becoming 'Abc ' in the example above).

    • It is possible that the substring within I contains only D. For example: D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f' would result in ['a', ',', 'b', 'c', 'd,e,,', 'f'].

    • When an input has a leading or trailing D, or two adjacent D, we'll have an empty item. I.e. D = ','; I = '"'; S = ',"a,b",c,,d,""' would result in ['', 'a,b', 'c', '', 'd', ''].

    • You can assume the inputs and outputs will only contain printable ASCII in the range [32, 126] (so excluding tabs and newlines).

    • You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).

    General rules:



    • This is code-golf, so shortest answer in bytes wins.

      Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


    • Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


    • Default Loopholes are forbidden.

    • If possible, please add a link with a test for your code (i.e. TIO).

    • Also, adding an explanation for your answer is highly recommended.

    Test cases:



    Input:
    D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
    Output:
    ['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']

    Input:
    D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
    Output:
    ['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']

    Input:
    D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
    Output:
    ['a', ',', 'b', 'c', 'd,e,,', 'f']

    Input:
    D = ','; I = '"'; S = ',"a,b",c,,d,""'
    Output:
    ['', 'a,b', 'c', '', 'd', '']

    Input:
    D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
    Output:
    ['contains no lowercase X nor Y']

    Input:
    D = ' '; I = 'I'; S = "I'll remove all I"
    Output:
    ["", "'ll remove all ", ""]

    Input:
    D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
    Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']

    Input:
    D = ' '; I = 'S'; S = 'regular split on spaces'
    Output:
    ['regular', 'split', 'on', 'spaces']









    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Inspired by this StackOverflow question.



      Input:



      We'll take three inputs:



      • A delimiter-character D to split on

      • A character I within we ignore the character to split on (I know, that sounds vague, but I'll explain it below)

      • A string S

      Output:



      A list/array containing the substrings after the split.



      Example:



      Input:
      D = ','
      I = '"'
      S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'

      Output:
      ['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']


      Why? Splitting on comma would normally also split 98,00, 12,000,000 and ,-, in two/three pieces. But because they are within the I input character, we ignore ignore the split here.



      Challenge rules:



      • You can assume there will always be an even amount of I characters in the input-string.

      • You can assume the character I will always have a D next to it (except when it's the first or last character of the input). So you won't have something like D = ','; I = '"'; S = 'a,b"c,d"e,f'.

      • The input-string S could contain none of either D or I. If it contains no D, we output a list with the entire input-string as only item.

      • The output list won't contain the character I anymore, even when it contained no D (as you can see at the "Abc " becoming 'Abc ' in the example above).

      • It is possible that the substring within I contains only D. For example: D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f' would result in ['a', ',', 'b', 'c', 'd,e,,', 'f'].

      • When an input has a leading or trailing D, or two adjacent D, we'll have an empty item. I.e. D = ','; I = '"'; S = ',"a,b",c,,d,""' would result in ['', 'a,b', 'c', '', 'd', ''].

      • You can assume the inputs and outputs will only contain printable ASCII in the range [32, 126] (so excluding tabs and newlines).

      • You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).

      General rules:



      • This is code-golf, so shortest answer in bytes wins.

        Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


      • Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


      • Default Loopholes are forbidden.

      • If possible, please add a link with a test for your code (i.e. TIO).

      • Also, adding an explanation for your answer is highly recommended.

      Test cases:



      Input:
      D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
      Output:
      ['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']

      Input:
      D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
      Output:
      ['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']

      Input:
      D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
      Output:
      ['a', ',', 'b', 'c', 'd,e,,', 'f']

      Input:
      D = ','; I = '"'; S = ',"a,b",c,,d,""'
      Output:
      ['', 'a,b', 'c', '', 'd', '']

      Input:
      D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
      Output:
      ['contains no lowercase X nor Y']

      Input:
      D = ' '; I = 'I'; S = "I'll remove all I"
      Output:
      ["", "'ll remove all ", ""]

      Input:
      D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
      Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']

      Input:
      D = ' '; I = 'S'; S = 'regular split on spaces'
      Output:
      ['regular', 'split', 'on', 'spaces']









      share|improve this question













      Inspired by this StackOverflow question.



      Input:



      We'll take three inputs:



      • A delimiter-character D to split on

      • A character I within we ignore the character to split on (I know, that sounds vague, but I'll explain it below)

      • A string S

      Output:



      A list/array containing the substrings after the split.



      Example:



      Input:
      D = ','
      I = '"'
      S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'

      Output:
      ['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']


      Why? Splitting on comma would normally also split 98,00, 12,000,000 and ,-, in two/three pieces. But because they are within the I input character, we ignore ignore the split here.



      Challenge rules:



      • You can assume there will always be an even amount of I characters in the input-string.

      • You can assume the character I will always have a D next to it (except when it's the first or last character of the input). So you won't have something like D = ','; I = '"'; S = 'a,b"c,d"e,f'.

      • The input-string S could contain none of either D or I. If it contains no D, we output a list with the entire input-string as only item.

      • The output list won't contain the character I anymore, even when it contained no D (as you can see at the "Abc " becoming 'Abc ' in the example above).

      • It is possible that the substring within I contains only D. For example: D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f' would result in ['a', ',', 'b', 'c', 'd,e,,', 'f'].

      • When an input has a leading or trailing D, or two adjacent D, we'll have an empty item. I.e. D = ','; I = '"'; S = ',"a,b",c,,d,""' would result in ['', 'a,b', 'c', '', 'd', ''].

      • You can assume the inputs and outputs will only contain printable ASCII in the range [32, 126] (so excluding tabs and newlines).

      • You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).

      General rules:



      • This is code-golf, so shortest answer in bytes wins.

        Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


      • Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


      • Default Loopholes are forbidden.

      • If possible, please add a link with a test for your code (i.e. TIO).

      • Also, adding an explanation for your answer is highly recommended.

      Test cases:



      Input:
      D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
      Output:
      ['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']

      Input:
      D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
      Output:
      ['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']

      Input:
      D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
      Output:
      ['a', ',', 'b', 'c', 'd,e,,', 'f']

      Input:
      D = ','; I = '"'; S = ',"a,b",c,,d,""'
      Output:
      ['', 'a,b', 'c', '', 'd', '']

      Input:
      D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
      Output:
      ['contains no lowercase X nor Y']

      Input:
      D = ' '; I = 'I'; S = "I'll remove all I"
      Output:
      ["", "'ll remove all ", ""]

      Input:
      D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
      Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']

      Input:
      D = ' '; I = 'S'; S = 'regular split on spaces'
      Output:
      ['regular', 'split', 'on', 'spaces']






      code-golf string






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 43 mins ago









      Kevin Cruijssen

      32.5k554174




      32.5k554174




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          2
          down vote














          R, 19 bytes



          Regular unmodified scan with the appropriate arguments for text, sep and quote should do it.



          scan(,t=S,"",,,D,I)


          Try it online!



          (The "" argument for what could be modified to S for -1, but in the interest of clarity, I've left as is.)






          share|improve this answer
















          • 2




            As usual, R leading the way on string splitting challenges.
            – ngm
            31 mins ago






          • 2




            Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
            – Kevin Cruijssen
            30 mins ago










          • I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
            – J.Doe
            28 mins ago











          • @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
            – J.Doe
            6 mins ago

















          up vote
          2
          down vote














          C (gcc), 64 bytes





          c;f(d,i,s)char*s;c?*s:10);


          Try it online!






          share|improve this answer



























            up vote
            0
            down vote














            Python 2, 71 bytes





            D,I,S=input()
            k=1
            for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1


            Try it online!





            share



























              up vote
              -1
              down vote













              Python 3, 47 chars



              ''.join(list(filter(lambda x:x!=I,S))).split(D)


              Try It Online!






              share|improve this answer










              New contributor




              A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

















                Your Answer




                StackExchange.ifUsing("editor", function ()
                return StackExchange.using("mathjaxEditing", function ()
                StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
                StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                );
                );
                , "mathjax-editing");

                StackExchange.ifUsing("editor", function ()
                StackExchange.using("externalEditor", function ()
                StackExchange.using("snippets", function ()
                StackExchange.snippets.init();
                );
                );
                , "code-snippets");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "200"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                convertImagesToLinks: false,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f174896%2fsplit-it-but-not-all%23new-answer', 'question_page');

                );

                Post as a guest






























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                2
                down vote














                R, 19 bytes



                Regular unmodified scan with the appropriate arguments for text, sep and quote should do it.



                scan(,t=S,"",,,D,I)


                Try it online!



                (The "" argument for what could be modified to S for -1, but in the interest of clarity, I've left as is.)






                share|improve this answer
















                • 2




                  As usual, R leading the way on string splitting challenges.
                  – ngm
                  31 mins ago






                • 2




                  Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
                  – Kevin Cruijssen
                  30 mins ago










                • I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
                  – J.Doe
                  28 mins ago











                • @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
                  – J.Doe
                  6 mins ago














                up vote
                2
                down vote














                R, 19 bytes



                Regular unmodified scan with the appropriate arguments for text, sep and quote should do it.



                scan(,t=S,"",,,D,I)


                Try it online!



                (The "" argument for what could be modified to S for -1, but in the interest of clarity, I've left as is.)






                share|improve this answer
















                • 2




                  As usual, R leading the way on string splitting challenges.
                  – ngm
                  31 mins ago






                • 2




                  Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
                  – Kevin Cruijssen
                  30 mins ago










                • I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
                  – J.Doe
                  28 mins ago











                • @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
                  – J.Doe
                  6 mins ago












                up vote
                2
                down vote










                up vote
                2
                down vote










                R, 19 bytes



                Regular unmodified scan with the appropriate arguments for text, sep and quote should do it.



                scan(,t=S,"",,,D,I)


                Try it online!



                (The "" argument for what could be modified to S for -1, but in the interest of clarity, I've left as is.)






                share|improve this answer













                R, 19 bytes



                Regular unmodified scan with the appropriate arguments for text, sep and quote should do it.



                scan(,t=S,"",,,D,I)


                Try it online!



                (The "" argument for what could be modified to S for -1, but in the interest of clarity, I've left as is.)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 35 mins ago









                J.Doe

                1,791112




                1,791112







                • 2




                  As usual, R leading the way on string splitting challenges.
                  – ngm
                  31 mins ago






                • 2




                  Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
                  – Kevin Cruijssen
                  30 mins ago










                • I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
                  – J.Doe
                  28 mins ago











                • @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
                  – J.Doe
                  6 mins ago












                • 2




                  As usual, R leading the way on string splitting challenges.
                  – ngm
                  31 mins ago






                • 2




                  Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
                  – Kevin Cruijssen
                  30 mins ago










                • I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
                  – J.Doe
                  28 mins ago











                • @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
                  – J.Doe
                  6 mins ago







                2




                2




                As usual, R leading the way on string splitting challenges.
                – ngm
                31 mins ago




                As usual, R leading the way on string splitting challenges.
                – ngm
                31 mins ago




                2




                2




                Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
                – Kevin Cruijssen
                30 mins ago




                Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
                – Kevin Cruijssen
                30 mins ago












                I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
                – J.Doe
                28 mins ago





                I mean... scan is a function already. I can prefix the thing with function(D, I, S) if that's conformant, but really, this is how you'd call it anyway.
                – J.Doe
                28 mins ago













                @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
                – J.Doe
                6 mins ago




                @KevinCruijssen Can I submit scan for 4 bytes and then call it with the arguments in the appropriate places?
                – J.Doe
                6 mins ago










                up vote
                2
                down vote














                C (gcc), 64 bytes





                c;f(d,i,s)char*s;c?*s:10);


                Try it online!






                share|improve this answer
























                  up vote
                  2
                  down vote














                  C (gcc), 64 bytes





                  c;f(d,i,s)char*s;c?*s:10);


                  Try it online!






                  share|improve this answer






















                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote










                    C (gcc), 64 bytes





                    c;f(d,i,s)char*s;c?*s:10);


                    Try it online!






                    share|improve this answer













                    C (gcc), 64 bytes





                    c;f(d,i,s)char*s;c?*s:10);


                    Try it online!







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 18 mins ago









                    l4m2

                    3,9581431




                    3,9581431




















                        up vote
                        0
                        down vote














                        Python 2, 71 bytes





                        D,I,S=input()
                        k=1
                        for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1


                        Try it online!





                        share
























                          up vote
                          0
                          down vote














                          Python 2, 71 bytes





                          D,I,S=input()
                          k=1
                          for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1


                          Try it online!





                          share






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote










                            Python 2, 71 bytes





                            D,I,S=input()
                            k=1
                            for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1


                            Try it online!





                            share













                            Python 2, 71 bytes





                            D,I,S=input()
                            k=1
                            for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1


                            Try it online!






                            share











                            share


                            share










                            answered 7 mins ago









                            Lynn

                            48.8k694223




                            48.8k694223




















                                up vote
                                -1
                                down vote













                                Python 3, 47 chars



                                ''.join(list(filter(lambda x:x!=I,S))).split(D)


                                Try It Online!






                                share|improve this answer










                                New contributor




                                A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.





















                                  up vote
                                  -1
                                  down vote













                                  Python 3, 47 chars



                                  ''.join(list(filter(lambda x:x!=I,S))).split(D)


                                  Try It Online!






                                  share|improve this answer










                                  New contributor




                                  A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.



















                                    up vote
                                    -1
                                    down vote










                                    up vote
                                    -1
                                    down vote









                                    Python 3, 47 chars



                                    ''.join(list(filter(lambda x:x!=I,S))).split(D)


                                    Try It Online!






                                    share|improve this answer










                                    New contributor




                                    A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    Python 3, 47 chars



                                    ''.join(list(filter(lambda x:x!=I,S))).split(D)


                                    Try It Online!







                                    share|improve this answer










                                    New contributor




                                    A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    share|improve this answer



                                    share|improve this answer








                                    edited 1 min ago





















                                    New contributor




                                    A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    answered 12 mins ago









                                    A.Aydin

                                    1




                                    1




                                    New contributor




                                    A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.





                                    New contributor





                                    A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






                                    A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f174896%2fsplit-it-but-not-all%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        What does second last employer means? [closed]

                                        List of Gilmore Girls characters

                                        Confectionery