Saturday, October 25, 2025
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

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS