Jump to content
Sign in to follow this  

String in String (number)

Recommended Posts


I want to check if there are numbers 2x (or 3x) in a variable, for example for

$var = 47253

it should return false or 0. For

$var = 47252 or $var = 47242

it should return true or 1. And for

$var = 47222

it should return false or 0

If that's not possible, I want to check for the number of strings in a function, for example if i have

$var = 58355

I want to check for 5 in this variable, and it should return 3. For

$var = 73642

Check for 7 it should return 1

Share this post

Link to post
Share on other sites

Why return 0 for $var = 47222 when the condition is 2 or 3 times the same number?

Anyway what have you tried ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

Not able to verify the condition of the First part

Here is the Example for the second part

Func _Occurance($String, $SubString)
StringRegExpReplace($String, StringRegExpReplace($SubString, "(\W)", "[\1]"), "")
Return @extended
EndFunc   ;==>_Occurance

MsgBox(0, "Return:", _Occurance(58355, 5))
MsgBox(0, "Return:", _Occurance(73642, 7))

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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