Thursday, April 2, 2026
HomeLanguagesJavascriptFabric.js graphemeSplit() Method

Fabric.js graphemeSplit() Method

The graphemeSplit() method is used to divide a specified string in the user perceived single units that is each characters of the specified string will be converted into a single unit of string.

Syntax:

graphemeSplit(textstring)

Parameters: This method accepts a parameter as mentioned above and described below:

  • textstring: This parameter holds the string to divide.

Return Value: This method returns the array containing the graphemes that is the divided characters.

Example 1:

Javascript




<!DOCTYPE html>
  
<html>
  
<head>
   <script src=
   </script>
  
   <script type="text/javascript" src=
   </script>
  
   <script type="text/javascript" src=
   </script>
</head>
  
<body>
   <script type="text/javascript">
        console.log(fabric.util.string.graphemeSplit("GFG"));
        console.log(fabric.util.string.graphemeSplit("G F G"));
   </script>
  
</body>
  
</html>


Output:

["G","F","G"]
["G"," ","F"," ","G"]

Example 2:

Javascript




<!DOCTYPE html>
  
<html>
  
<head>
   <script src=
   </script>
  
   <script type="text/javascript" src=
   </script>
  
   <script type="text/javascript" src=
   </script>
</head>
  
<body>
   <script type="text/javascript">
       console.log("Using graphemeSplit() Function:");
       var value = "12ab";
       console.log(fabric.util.string.graphemeSplit(value));
  
       console.log("Without using graphemeSplit() Function:");
       var value="12ab";
       console.log(value);
   </script>
  
</body>
  
</html>


Output:

Using graphemeSplit() Function:
["1","2","a","b"]
Without using graphemeSplit() Function:
12ab
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32512 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6885 POSTS0 COMMENTS
Nicole Veronica
12006 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12100 POSTS0 COMMENTS
Shaida Kate Naidoo
7015 POSTS0 COMMENTS
Ted Musemwa
7259 POSTS0 COMMENTS
Thapelo Manthata
6971 POSTS0 COMMENTS
Umr Jansen
6960 POSTS0 COMMENTS