Is it possible to override String.split function in Salesforce Apex?How can I use Pattern and Matcher instead of split() to do this?regex too complicated error when using split function for less than 1M charactersBest way to parse “stringified” (sub-)Map<String,String>Catch Regex too complicated when splitting a string in salesforceDoes APEX support variable arguments (`varargs` in Java`)Is it possible to take the whole post String as the parameter in rest api method?parser to convert values including fraction to decimalHow to split the values in fieldApex variable usage in javascript functionHow to use Split() function inside an Expression in lightning component

Why is this Simple Puzzle impossible to solve?

Is there a way to make it so the cursor is included when I prtscr key?

Why does the 6502 have the BIT instruction?

How does an ARM MCU run faster than the external crystal?

Different circular sectors as new logo of the International System

Can't remember the name of this game

Why colon to denote that a value belongs to a type?

Is cutting a DIY spline channel around the openings of our wood screen porch a dumb idea?

Rename photos to match video titles

Is there an efficient way to replace text matching the entire content of one file with the entire content of another file?

Is the Indo-European language family made up?

Why are C64 games inconsistent with which joystick port they use?

Full horizontal justification in table

Python program to convert a 24 hour format to 12 hour format

Under what law can the U.S. arrest International Criminal Court (ICC) judges over war crimes probe?

Looking for a soft substance that doesn't dissolve underwater

Flying domestically in the US, is my State Issued ID all I need to get past security?

Why does the 'metric Lagrangian' approach appear to fail in classical mechanics?

How to respond to an upset student?

What is the largest (size) solid object ever dropped from an airplane to impact the ground in freefall?

analysis of BJT PNP type - why they can use voltage divider?

Old short story, same personalities, differing planes of existence

Command to Search for Filenames Exceeding 143 Characters?

Using the smallest number of bytes of code, write a program that produces this image



Is it possible to override String.split function in Salesforce Apex?


How can I use Pattern and Matcher instead of split() to do this?regex too complicated error when using split function for less than 1M charactersBest way to parse “stringified” (sub-)Map<String,String>Catch Regex too complicated when splitting a string in salesforceDoes APEX support variable arguments (`varargs` in Java`)Is it possible to take the whole post String as the parameter in rest api method?parser to convert values including fraction to decimalHow to split the values in fieldApex variable usage in javascript functionHow to use Split() function inside an Expression in lightning component






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I want to override split function of String class with one more parameter.
Is it possible?



String s = 'aKey:aValue::bKey:bValue::cKey:cValue';
Map<String, String> mapS = s.split(':', 0, '::');

//something like ..
//String.split(String primarySeparator, Integer limit, String secondarySeparator)


If not can I create custom function in String class?










share|improve this question




























    1















    I want to override split function of String class with one more parameter.
    Is it possible?



    String s = 'aKey:aValue::bKey:bValue::cKey:cValue';
    Map<String, String> mapS = s.split(':', 0, '::');

    //something like ..
    //String.split(String primarySeparator, Integer limit, String secondarySeparator)


    If not can I create custom function in String class?










    share|improve this question
























      1












      1








      1








      I want to override split function of String class with one more parameter.
      Is it possible?



      String s = 'aKey:aValue::bKey:bValue::cKey:cValue';
      Map<String, String> mapS = s.split(':', 0, '::');

      //something like ..
      //String.split(String primarySeparator, Integer limit, String secondarySeparator)


      If not can I create custom function in String class?










      share|improve this question














      I want to override split function of String class with one more parameter.
      Is it possible?



      String s = 'aKey:aValue::bKey:bValue::cKey:cValue';
      Map<String, String> mapS = s.split(':', 0, '::');

      //something like ..
      //String.split(String primarySeparator, Integer limit, String secondarySeparator)


      If not can I create custom function in String class?







      apex string split






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 14 at 11:16









      tejas033tejas033

      63




      63




















          1 Answer
          1






          active

          oldest

          votes


















          6














          No. The Apex language has no support for what other languages might call mixins or categories. You can only subclass and extend classes declared virtual or abstract, which the system's String class is not.



          Your functionality must go in one of your own classes.



          See Apex Class Definition for a bit more detail on what you can do in defining an Apex class.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "459"
            ;
            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f262306%2fis-it-possible-to-override-string-split-function-in-salesforce-apex%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            6














            No. The Apex language has no support for what other languages might call mixins or categories. You can only subclass and extend classes declared virtual or abstract, which the system's String class is not.



            Your functionality must go in one of your own classes.



            See Apex Class Definition for a bit more detail on what you can do in defining an Apex class.






            share|improve this answer



























              6














              No. The Apex language has no support for what other languages might call mixins or categories. You can only subclass and extend classes declared virtual or abstract, which the system's String class is not.



              Your functionality must go in one of your own classes.



              See Apex Class Definition for a bit more detail on what you can do in defining an Apex class.






              share|improve this answer

























                6












                6








                6







                No. The Apex language has no support for what other languages might call mixins or categories. You can only subclass and extend classes declared virtual or abstract, which the system's String class is not.



                Your functionality must go in one of your own classes.



                See Apex Class Definition for a bit more detail on what you can do in defining an Apex class.






                share|improve this answer













                No. The Apex language has no support for what other languages might call mixins or categories. You can only subclass and extend classes declared virtual or abstract, which the system's String class is not.



                Your functionality must go in one of your own classes.



                See Apex Class Definition for a bit more detail on what you can do in defining an Apex class.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 14 at 11:24









                David ReedDavid Reed

                43.3k82564




                43.3k82564



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Salesforce Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f262306%2fis-it-possible-to-override-string-split-function-in-salesforce-apex%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown