File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ <#@ template debug="true" hostspecific="true" language="C#" #>
2+ <#@ output extension="\\" #>
3+ <#+
4+ class Utils {
5+ public static List<string> splitString(string str, int chunkSize) {
6+ // Removing non-breaking space in a string
7+ str = str.Replace("\u00A0", " ");
8+ List<string> multiLineDescription = new List<string>();
9+ if(str != null) {
10+ string[] words = str.Split(' ');
11+ string singleLineDescription = "";
12+ foreach(var word in words) {
13+ if(word == "") {
14+ continue;
15+ }
16+ var descriptionBeforeValuation = "";
17+ if(singleLineDescription == "") {
18+ descriptionBeforeValuation = word;
19+ } else {
20+ descriptionBeforeValuation = singleLineDescription + " " + word;
21+ }
22+ if(descriptionBeforeValuation.Length < chunkSize) {
23+ singleLineDescription = descriptionBeforeValuation;
24+ } else {
25+ multiLineDescription.Add(singleLineDescription);
26+ singleLineDescription = word;
27+ }
28+ }
29+ if(singleLineDescription != "") {
30+ multiLineDescription.Add(singleLineDescription);
31+ }
32+ }
33+ return multiLineDescription;
34+ }
35+ }
36+ #>
You can’t perform that action at this time.
0 commit comments