Jump to content
Sign in to follow this  
mblunk

Counting occurances of a substring in a string

Recommended Posts

mblunk

Ok, I found a way to store data in my newegg computer builder, however I need a way to find how many times a substring is found is string in order to find out how many items are in each group. I tried making my own function for it, but it doesn't seem to work (always returns 1)

http://pastebin.org/4770

Edited by mblunk

Share this post


Link to post
Share on other sites
Valuater

$text = StringReplace("this is a line of text", " ", "-")
$numreplacements = @extended
MsgBox(0, "New string is", $text)
MsgBox(0, "The number of replacements done was", $numreplacements)

@Extended is your answer, you do not need to "change or replace" the actual info

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
mblunk

$text = StringReplace("this is a line of text", " ", "-")
$numreplacements = @extended
MsgBox(0, "New string is", $text)
MsgBox(0, "The number of replacements done was", $numreplacements)

@Extended is your answer, you do not need to "change or replace" the actual info

8)

Oh, thanks. I thought there was probably something already built-in, and I thought I remembered seeing it before, but I couldn't find it after a few minutes of searching in the help so I posted here. Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.