---
title: "How to split the string in to different parts"  
description: "How to split the string in to different parts"  
author: "Manoj Bhatt"  
published: 2013-05-15  
updated: 2013-05-15  
canonical: https://www.mindstick.com/forum/883/how-to-split-the-string-in-to-different-parts  
category: "javascript"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# How to split the string in to different parts

Hi Everyone! \
I want to [split](https://www.mindstick.com/blog/11920/top-3-voltas-split-acs-for-your-home) the [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) in to different parts. I will have some string which will be generated dynamically which will contains 500 [characters](https://answers.mindstick.com/qa/42112/who-is-the-originator-of-avengers-characters). I want to split in to 5 parts. What i [mean](https://yourviews.mindstick.com/view/80768/what-does-real-minority-mean) is i want to take 100 characters in to [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net)[0], next 100 characters in array[1] ....\
Example:\
[var](https://www.mindstick.com/forum/33920/what-is-different-var-and-dynamic-types-in-c-sharp) string = "kjfaorj......................................................."; array[0] = "kjfaorj..... up to 100 characters"; array[1] = " next 100 characters ";\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Manoj!\
if(str.length % 100 == 0) //If the string contains exactly 500 or 400...etc count = str.length / 100; else count = str.length / 100 +1; //If the string contains exactly 505 or 417...etc\
for(var i=0;i<count;i++) array[i] = s.substring(i,i*100-1);\
Second approach is good for dynamic string\
Thanks in advance! \


---

Original Source: https://www.mindstick.com/forum/883/how-to-split-the-string-in-to-different-parts

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
