Jump to content

Read folder name, then remove part of it


Go to solution Solved by Melba23,

Recommended Posts

  • Moderators

quinnj09,

 

Any ideas?

Lots - but what have you tried that has not worked? And how do you determine the folder name initially? Selected from a list? Matched in a search? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Same here, show us what code you've come up with so far, and we'll help fill in any missing gaps you may have.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Sorry for the slow reply guys, had some progress, im taking the name from an input label, it then removes any letters, so it does what I wanted it to do... well at least it did until I cam across this issue:

label might have in it '1234 - dog' which is fine because this then gives be '1234' which then is changed to 'fix1234' however yesterday I had one which was '5678 - 100 monkey' so this should of turned out to be '5678' which is then changed to 'fix5678' however as im sure youve already guess I actually got '5678100' then 'fix5678100'

Now I cant split the string and say take the first four numbers, because its not always four, sometimes its only three, sometimes its as many as nine, I basically need it to chuck away everything after the first space, this would then leave me with just '5678' in the last example.

$projectnumber = GUICtrlRead($projectname)
$fix_id_value=StringRegExpReplace($fixnumber,"\D+","")
GUICtrlSetData($fix_id, "fix" & $fix_id_value)
Link to comment
Share on other sites

  • Moderators
  • Solution

cookiemonster,

This SRER works for me:

Global $aList[3] = ["1234 - dog", "5678 - 100 monkey", "123456789 - 500 pig"]

For $i = 0 To 2
    $sRet = StringRegExpReplace($aList[$i], "(\d+)\s.*", "fix$1")
    ConsoleWrite($sRet & @CRLF)
Next
Decode:

(\d+)   ; Look for a series of digits and capture it
\s      ; Until we reach a space
.*      ; Followed by the rest of the line

fix$1   ; Return the captured group prefixed with fix
All clear? :)

 

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Either split it at the first space ..... or the dash and then remove all spaces from the end result using StringStripWS.

The beauty with the second method, is that it accounts for a circumstance where the space may be missing ... though I'm not sure whether that is at all possible, so may be entirely unnecessary.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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...