VB Script:number of times a character appears in a string with position - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: VB Script:number of times a character appears in a string with position (/Thread-VB-Script-number-of-times-a-character-appears-in-a-string-with-position) |
VB Script:number of times a character appears in a string with position - Jyobtech - 08-06-2013 Dear Experts, Please help me out , How do I count the number of times a character appears in a string with position . My code given below working fine but i am not able to find position of the character. Code: sample="this, that, other, thing, too" Thanks in advance RE: VB Script:number of times a character appears in a string with position - anil2u - 08-07-2013 Hi, We can find the number of occurences in many ways, but as far as I know we have to use the regular loops to get the position numbers with a few modifications Code: Dim i, index, arr() In the above code you can also replace strcomp with instr(1, string,"searchstring", compareType) to get the same result. Cheers |