Jump to content
Sign in to follow this  
Tsongkie

Help with string

Recommended Posts

Tsongkie

Hi guys i hope this is possible with a string

lets say its a long string like:

inmycomputer&myfolderid=113579

what I need is the 113579. How do I extract that?

Share this post


Link to post
Share on other sites
Tsongkie

also every string number i need like (113579) as stated in the example above this post begins with myfolderid= and then the number I need. I tried the help file but I cant find anything that works. so in pseudo it should look like this

1. find myfolder= in string

2. get the numbers after the "=" sign.

thanks for the help.

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

#include<Array.au3>
#include<String.au3>
Global $string = "inmycomputer&myfolderid=113579"
Global $found = StringRegExp($string, "\d{1,}", 3)
_ArrayDisplay($found, "Deine Zahl")

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
PerryRaptor

$What_I_Want = 113579
$ThisString = "inmycomputer&myfolderid=113579"
$FindThis = '='
$LetsSee = StringTrimLeft ($ThisString , (StringInStr ($ThisString , $FindThis,0,-1)))
MsgBox(0,"Help with String", $LetsSee)

This searches the string from right to left looking for the '=' sign. It records the character position from left to right, then erases everything left of the '=', including the '=' too.

Edited by PerryRaptor

Share this post


Link to post
Share on other sites
PerryRaptor

He wanted the serial number to the right of the equal sign so...

$found = $found[2]

Share this post


Link to post
Share on other sites
xcal

How about...

$string = 'inmycomputer&myfolderid=113579'
$hold = ''
$array = StringSplit($string, '')

Local $match[10] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']

For $i = 1 To $array[0]
    For $x = 0 To 9
        If $array[$i] = $match[$x] Then $hold &= $array[$i]
    Next
Next

MsgBox(0, 'Result', $hold)

Ok, I was bored. :)

@Rein: Don't do this. :D

Edited by xcal

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.