How can i parse the number from the string each time automatic ?

I have this two lines:
last_file = fi[fi.Length - 1].FullName;
string lastFileNumber = last_file.Substring(86, 6);
In last_file i have: C:\\Users\\chocolade1972\\AppData\\Local\\mws\\My Weather Station\\radar_temp_directory\\radar000142.gif
So i counted and found that the number in this case 000124 is starting from index 86 and length 6
But for example on my brother pc the directory is shorter the name is not chocolade1972 so the index is incorrect.
It's not 86.
How can i use the Substring to find the correct index every time on any pc that have a differenet directory length ?
In this case it's working fine on my pc for any image i can get the number no problems. But i want it to work also on other pc's.

You can use Regex to match the filename you want. 
Like Giovhan suggested you can first get the filename like:
string result;
result = Path.GetFileName(fileName);// in your example result = radar000142// in my regex I assume that a file can have a number of digits between 5 to 7 digits.Regex filenameRegex = new Regex("\d{5,7}");string number = filenameRegex.Match(result).Value;// by that way you can retrieve all numbers between 5 to 7 digits regardless of filename whether contains all 6 digits// or file that may contain 5 or 7 digits // You can play with the Regex code to decrease or increase number of digits by changing the numbers

Similar Messages

  • How can I print the date and time in a photo from iPhoto

    How can I print the date and time in a photo from iPhoto

    You want to print them on their own? Can't be done. WIth the photo? Install this
    http://www.iborderfx.com/iborderfx/

  • I lost my Serial number for InDesign and need it to load InDesign not my new iMac. How can I request my number from Adobe?

    I lost my Serial number for InDesign and need it to load InDesign not my new iMac. How can I request my number from Adobe?

    Could it be registered under a different identity? I've used three identities over the years to register stuff, so I have to do some looking around to find stuff. Try old email addresses as possible IDs.

  • How can I copy the date and time in Mail header?

    How can I copy the date and time in Mail header?
    I can copy everything else in the header for pasting in another application. 
    But not the date and time which is absolutely vital.
    It was ok in 10.6 

    I suppose you could copy it from the Raw Source. View>Message>Raw Source

  • How can i check the procedure execution time..?

    Hi All,
    Can any one of you tell me how can i check the procedure execution time..?
    Thanks in advance.

    if running it from SQL*Plus,
    SQL> set timing on
    Or from PL/SQL, use DBMS_UTILITY.GET_TIME before and after the call and calclate the difference.

  • HT5295 How can I stop the auto play feature automatically playing/streaming the next podcast?

    How can I stop the auto play feature automatically playing/streaming the next podcast?

    Hi there.
    I listened to podcast there were two things I found that helped me out. Both we're in the podcast app itself.
    Firstly change the default sorting order. When looking at the list off episodes a available on your ios device tap on the description part at the top, this will bring up the settings for that podcast (subscribe mark as played etc) scroll to the Bottom and select oldest first. This will mean that if you are listening to the latest download it will stop at the end as there will be no more to play.
    Secondly, and useful if listening to older podcasts in the list, you can use the timer to stop once the current episode has ended. To do this when you are in the podcast playback screen slide the "album artwork" up, revealing the playback options and nifty tape playing animation this is where you adjust playback speed and set a timer. The timer has a number of options to set playback to stop after set amount of time. However one of these options is to stop once the current episode you are listening to ends. This can also be current chapter if the podcast you are listening to supports chapters.
    Hope this helps, if not clear let me know

  • I have recently moved all of my files to a larger external hard drive, but when I am reminder of an itunes upgrade it's still attempting to go to the old drive.  How can I change the settings so it automatically goes to my new hard drive?

    I have recently moved all of my files to a larger external hard drive, but when I am reminder of an itunes upgrade it's still attempting to go to the old drive.  How can I change the settings so it automatically goes to my new hard drive?

    lisacooney wrote:
    I have recently moved all of my files to a larger external hard drive
    How did you move these files?

  • How can I make the status bar hide automatically when using safari?

    How can I make the status bar hide automatically when using safari?

    When Safari is in FullScreen mode, menu bar will be hidden.
    Safari window to fit the screen?
    Move the mouse pointer to the bottom right corner of the Safari window.
    Double arrows will appear. Drag it to resize the window to fit the screen.

  • How can I make the iPhone podcast app automatically stop playing after one episode?

    How can I make the iPhone podcast app automatically stop playing after one episode?

    When playing a song, are the controls at the top of the screen there? (Genius, Shuffle, Loop?)
    If not, tap the center of the page once to expose them
    now keep tapping the circle on the left part of the exposed controls untill a one (1) appears...

  • How can I get the date and time and display it on the report main page?

    Gurus,
    How can I get the date and time and display it on the report main page?
    Thanks!

    Hello,
    You can create a Formula Colum returning a date :
    function CF_1Formula return Date is
    begin
    RETURN(SYSDATE);
    end;
    Put a Field in the Layout having this formula column as source .
    Regards

  • How can I disable the system feature which automatically restarts applications i had open during a previous session ?

    How can I disable the system feature which automatically restarts applications i had open during a previous session ?

    When you log out, uncheck the box to reopen applications. If you're still using 10.7.3, then you will have to uncheck the back with each shutdown or restart.
    10.7.4 update was suppose to fix it that when you uncheck the box, it should remain unchecked for restarts after that.
    For the resume features, check this link:
    http://reviews.cnet.com/8301-13727_7-20083707-263/managing-mac-os-x-lions-applic ation-resume-feature/?tag=mncol;title

  • How can I change the file download time using Adobe Send? Adobe SendNow had a lot more options.

    How can I change the file download time using Adobe Send? Adobe SendNow had a lot more options.I don't see nay with Adobe Send.

    There isn't a feature in Adobe Send for setting and end-date for a file's availability. At any time, you can Unshare the file, however.

  • How Can I Release sessions if these are idle long time Automatically.

    Dear Experts,
    How Can I Release sessions if these are idle long time Automatically based on some time frame..
    So that session memory will be free and when i go to reconnect the session then we will have enough memory for our transaction processing.
    I am asking this question because, In my case (Web Load Testing) after completion the processing this parameter still showing 86% Usage.
    so How Can I release it.

    Change value of IDLE_TIME in profile or better create new profile with less IDLE_TIME and assign to users.
    IDLE_TIME Allowed idle time before user is disconnected (minutes)
    Below is example if user is idle for 20 min , he/she will disconnect
    ALTER PROFILE developer LIMIT idle_time 20;
    Cheer,
    Virag Sharma

  • How can I convert/read out from a string Hex (8-bit), the bit 0 length 1

    How can I convert/read out from Hex (8-bit), the bit 0 length 1 (string subset!!??) and convert it to decimal.
    With respect to one complement and two complement ?

    Just like Jeff, purely guessing here.
    It almost sounds like you just need to Read from Binary File?
    AND the 8-bit number with 1?
    Need more details.  What exactly do you have to start with?  What exactly are you trying to get out of it?  Examples help.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I add the string to JList

    I have one string " teletoppy" and I have Jlist which have 5 items in it.
    After I press submit I want teletoppy added to the list.
    How can I write the command?
    because I try by using command_list.add("teletoppy", comp);
    I don't know what component is?how can I add it in?.

    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/list.html]How to Use Lists for a working example of how to do this. The "Hire" button adds the text from the text field to the JList.

Maybe you are looking for

  • Graduation project: ideas for a web application

    Hello, I apologize for posting this topic in here but I just need ideas from more experienced developers, we are a group of 5 students in computer science department and we are required to make a graduation project for a 1 year perioed, we have an av

  • Printing with a USB printer using Airport Extreme and Vista

    I have a airport extreme and it prints fine with all of my Macs. I bought a VAIO installed with Vista and the lastest service pack. Here is what I have done * Installed Bonjour Printing software on the Windows Machine * Installed the print drivers on

  • Help! My iTunes no longer shows my collection

    My music library and playlists have become the default iTunes showing only the purchases from the last 2 weeks. There were a couple things new that I did, one or both of which must have affected this: I moved my iTunes library, following accurate dir

  • Best practices on wlan configuration

    I have 6 accesspoints with controller . We are using voice video and data on the wireless with multiple SSID and vlans what could be the best practice on the accesspoints QOS and the switch port configuration of 3750 is it trunk or accessport? Sent f

  • GRAPH_RECEIVE with Stat_5 (new load) ??

    Dear ABAP Guru's, as newbie I'm try to code a chart with differnd nodes. So my idea is, to refresh the complete content after an input command. The normal examples are all are updates in the grafic-content (stat_4). When I build the refresh content a