Jump to content

[Help]Limiting Strings


Recommended Posts

Hi im facing some issue in a utility im coding to revert links.

I've found the way to reverse the link but my problem is at limiting to 'where' it should

be considered.

For example, we got the inverted following link:

http://telona.biz/protetor/?28YRO2UG=d?/moc.daolpuagem.www//:ptth

If we reverse this we will get the following:

http://www.megaupload.com/?d=GU2ORY82?/rotetorp/zib.anolet//:ptth

So far everything is ok, the proble is limiting the code to get the real link part:

http://www.megaupload.com/?d=GU2ORY82?/rotetorp/zib.anolet//:ptth

In this case the red part is the one needed. So what i did was a For counting from 0 to 36, that makes it count 37 characters which must return the full url correctly, my problem is that for a unknown reason, it adds a '65' number before the url...

This might be stupid and useless but i would really appreciatte any help.

Follows what I got:

#include <GUIConstants.au3>

Global $str_antes = "";link antes de ser invertido
Global $str_depois = "";link depois de ser invertido

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 202, 243, 193, 125)
$Input1 = GUICtrlCreateInput("", 16, 56, 169, 21)
$Label1 = GUICtrlCreateLabel("Inversor de Links 1.0", 16, 8, 176, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Inverter", 64, 88, 67, 25, 0)
$Button2 = GUICtrlCreateButton("Copiar", 64, 192, 67, 25, 0)
$Group1 = GUICtrlCreateGroup("Inversor", 8, 40, 185, 89)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Resultado", 8, 136, 185, 97)
$Input2 = GUICtrlCreateInput("", 16, 160, 169, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $str_antes = GUICtrlRead($Input1)
            _Revert()
        Case $Button2
            If $str_depois = "" Then
                MsgBox(0,"Erro","Sem link para ser copiado.")
            Else
            ClipPut($str_depois)
            MsgBox(0,"Link Copiado.")
            EndIf
    EndSwitch
WEnd

Func _Revert()
    Local $arrayString = StringSplit($str_antes, ""), $cont, $cont2, $Temp = ""
    For $cont = $arrayString[0] To 1 Step -1
        $Temp &= $arrayString[$cont]
    Next
    MsgBox(0,"String: ",$Temp)
    Local $NewArr = StringSplit($Temp, "")
    For $cont2 = 0 To 37 Step 1
        $str_depois &= $NewArr[$cont2]
    Next
    MsgBox(0,"String: ", $str_depois)
EndFunc
Link to comment
Share on other sites

Would this do it?

#include <String.au3>
Global $wrongstring, $correctstring, $output

$wrongstring = "http://telona.biz/protetor/?28YRO2UG=d?/moc.daolpuagem.www//:ptth"

$correctstring = _StringReverse($wrongstring)
$output = StringLeft($correctstring, 37)
Msgbox(0, "", $output)

#include <ByteMe.au3>

Link to comment
Share on other sites

nevermind.

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Would this do it?

#include <String.au3>
Global $wrongstring, $correctstring, $output

$wrongstring = "http://telona.biz/protetor/?28YRO2UG=d?/moc.daolpuagem.www//:ptth"

$correctstring = _StringReverse($wrongstring)
$output = StringLeft($correctstring, 37)
Msgbox(0, "", $output)

I tried this and got 'Unknown Function' error:

#include <GUIConstants.au3>

Global $wrong = "";link antes de ser invertido
Global $correct = "";link depois de ser invertido
Global $link = "";link correto

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 202, 243, 193, 125)
$Input1 = GUICtrlCreateInput("", 16, 56, 169, 21)
$Label1 = GUICtrlCreateLabel("Inversor de Links 1.0", 16, 8, 176, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Inverter", 64, 88, 67, 25, 0)
$Button2 = GUICtrlCreateButton("Copiar", 64, 192, 67, 25, 0)
$Group1 = GUICtrlCreateGroup("Inversor", 8, 40, 185, 89)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Resultado", 8, 136, 185, 97)
$Input2 = GUICtrlCreateInput("", 16, 160, 169, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $wrong = GUICtrlRead($Input1)
            $correct = _StringReverse($wrong)
            $link = StringLeft($correct, 37)
            MsgBox(0,"Link: ",$link)
        Case $Button2

    EndSwitch
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...