How to split text or string in JQuery using split() function with an example in ASP.NET


   JQuery is having split function, using this function we can able to split any text with the delimiter or regular expression. in the below example i have shown, how to split "ABC~BCA~234" string using split function in JQuery. After split function array will generate automatically, we have to use loop for displaying splitted values.

Example:
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js">
    </script>
    
    <script type="text/javascript">
        $(document).ready(function() {
            var text = "ABC~BCA~234";
            var arrayData = text.split("~");
            for (var i = 0; i < arrayData.length; i++) {
                alert(arrayData[i]);
            }
        });
    </script>
If this post useful for you, please write "Thank you" in comments"

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar