Jump to content
Sign in to follow this  

Help: How to work extract some characters from word.

Recommended Posts


Hey guys,

Can somebody help me with this?

Used word: AA:BB:CC

Constant word: 12345_5678

I need a script to take the last 3 character from AA:BB:CC, EXCEPT for the ":" symbol so that the result will be:







Share this post

Link to post
Share on other sites

How I would do it, most likely not the easiest way as I'm Sure it could be done with StringRegExpReplace

$vWord = "AA:BB:CC"
$vConstantWord = "12345_5678"

$vString = StringRight(StringReplace($vWord,":", ""), 3) ;~ AABBCC
$vString2 = StringSplit($vConstantWord, "_", 2) ;~ Split Constant Word Into Array

$vOutput = ($vString2[0] & $vString & "_" & $vString2[1]) ;~ 12345, BCC, _, 5678

Edited by mrflibblehat
  • Like 1

[font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]

Share this post

Link to post
Share on other sites

Thank you guys!

This code works too.. :thumbsup:

local $mystring = "AA:BB:CC"
$theStr = StringSplit($mystring, ":") ; Create an array
$theNewStr = ""

For $i = 1 to $theStr[0] Step 1
    $theNewStr = $theNewStr & $theStr[$i]
Local $result = StringTrimLeft($theNewStr, 3)
MsgBox(0, "New Text:", "12345" & $result & "_5678")

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.