Jump to content

Help with string manipulation


Recommended Posts

Guest cariveau3680

What am I doing wrong here?

I am trying to cut down strings like "c:\mydocs\myzips\testfile.zip" to "c:\mydocs\myzips" & "c:\mydocs\myzips\testfile" but it's not outputting anything

Global $StringTemp = ""

$StringIn = InputBox("StringTrimmer", "Please input a string to trim")
$DelIn = InputBox("StringTimmer", "Please input a delimiter")

$Ans = _StringTrimmer($StringIn, $DelIn)

MsgBox(0, "StringTrimmer", $StringIn & " trimmed with " & $DelIn & " is" & @CRLF & $Ans)

Func _StringTrimmer($String, $Del)
    $StringArray = StringSplit($String, $Del)
    For $Loop = 1 To $StringArray[$StringArray[0] - 1]
        $StringTemp = $StringTemp & $StringArray[$Loop]
        $StringTemp = $StringTemp & $Del
    Next
    Return $StringTemp
EndFunc

forgive me if this has been addressed

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...