Get the count of repeated characters from a string a string value.
static void repeatedCharecters(Args _args) { str subTextPrev,subTextAll,subText,subTextOne,text = "AAAABBBCCDDDDDDDDDRRRRSSSSTTTTTTAAAAAA"; int i,j,k; ; for (i = 1 ; i <= strLen(text) ; i++) { subText = subStr(text, i, 1); k = 0; for (j = 1 ; j <= strLen(text) ; j++) { subTextOne = subStr(text, j, 1); if (subTextOne == subText) { k++; } } if (!strFind(subTextAll, subText, 1, strLen(text))) { subTextAll += subText + int2Str(k) + "\n"; } } info(subTextAll); }
Keep Daxing!!
No comments:
Post a Comment